eepitch-send
leading to in-emacs common lisp image automata flockingeev
âs eepitch
sends text to a process in an emacs buffer like-a-human-did-it. Here I get lisp images accessing each-other as seen in the video like-a-human-was-doing-it.
You may have watched me floundering for the last few days to get eepitch as a broad spectrum programmatic communication mechanism working.
The best approach seems to be starting emacsâ server: M-x server-start
(same as running emacs with emacs --daemon
or emacsclient -c -a ""
) and then using emacsclient
to make calls from-the-outside.
#|
(defun eepitch-send
(buffername line)
(setq eepitch-buffer-name buffername)
(setq line (eepitch-preprocess-line line))
(eepitch-prepare)
(eepitch-line line))
|#
(in eev-mode, you can run this defun
with M-e
(âalt eâ) when the cursor is near it).
emacsclient
process(defun e-e-s (buffername expr)
"'external-eepitch-send'
buffername string (emacs buffer name string)
line string (as eepitch)
"
(require "asdf")
(uiop:launch-program
(let ((*print-pretty* nil))
(format
nil
"emacsclient --eval '(eepitch-send ~s "~s")'"
buffername expr))))
We used Barlowâs portable uiop:launch-program
to accomodate various lisps external program extensions.
In this example, each image will already know what resend
means, it will simply be pitched the message to invoke it from outside.
(defun resend ()
(let ((target
(nth (random 4)
`("*slime-repl ECL*"
"*slime-repl ECL<2>*"
"*slime-repl ECL<3>*"
"*slime-repl ECL<4>*")))
(wait (1+ (random 5))))
(e-e-s target
`(progn (sleep wait)
(resend)))))
resend
in all of them#|
(setq inferior-lisp-program "ecl")
(slime)
(slime) ; y
(slime) ; y
(slime) ; y
|#
defun
resend
in each of them.By the way, prin1
in elisp format
is â%Sâ and princ
is â%sâ which I was briefly bemused by.
(dolist (s `("*slime-repl ECL*"
"*slime-repl ECL<2>*"
"*slime-repl ECL<3>*"
"*slime-repl ECL<4>*"))
(sleep-for 2)
(eepitch-send
s
(format "%S"
'(defun resend ()
(let ((target
(nth (random 4)
`("*slime-repl ECL*"
"*slime-repl ECL<2>*"
"*slime-repl ECL<3>*"
"*slime-repl ECL<4>*")))
(wait (1+ (random 5))))
(e-e-s target
`(progn (sleep ,wait)
(resend))))))))
(resend)
Open the one minute video of them randomly pitching to each other. ( https://screwlisp.small-web.org/complex/resend resend resend.webm )
Using quick fingers, I got the cursor into one of the repls and interrupted it with C-c
to stop it. A more powerful control strategy is probably warranted.
We used externally provoked eepitches to send a message on an endless random tour of four slime repls in emacs, and watched them evolve live. It was possible to stop by catching and interrupting the messaging process.
This exhibits a simple flocking behaviour - choose another member of the flock, and throw the ball to them next.
This datagram approach seems good enough to implement a higher level messaging protocol.
It also shows that several lisp images can be watched working together live unattended. This fits well with the grand scale lisp programs including slime, emacs and eev tend towards.
This seems particularly good enough to step in for Sandewallâs internet Madman, which was a web server and framework I did not attempt to port out of 2014. So look forward to me moving back to my software-individuals in a big way.
Coming up next week, I will be interviewing Ksaj about Braitenbergâs Vehicles and Ksajâs work on flocking computer life. I guess the above are my current automata.
Actually on that front, when Ksaj and I were talking before, I remember him asking if there is one in charge vehicle in my software-individuals. My answer is no. I donât consider emacs to truly be in charge above. Emacs has no idea what I am doing with it.
It seems important to mention the unsophistication of my datagrams above, given JMBRâs contribution to common lispâs open MPI interface. However I will use my above datagrams to implement some of Sandewallâs software-individuals communication protocols.
Since this abutts sophisticated automata, I am looking forward to hearing from everyone about your automata. In particular, I like the idea of four lisp images working together.
On the mastodon thread as always please.
And hang out live during Ksajâs live interview next week at 0UTC Wednesday on https://anonradio.net as always, and chat in https://lambda.moo.mud.org or #emacsconf on liberachat IRC.
screwlisp proposes kittens