--- layout: ../Site.layout.js --- # Leonardo Calculus Knowledge Representation: Object Oriented Simulation Simulation Lisp Useage (Great Example if I do say) In this useful article, we are going to recapitulate and distill the normal useage of 1. [Embeddable Common Lisp](https://ecl.common-lisp.dev/) with a [McCLIM](https://mcclim.common-lisp.dev/main.html) [GUI](/lispgames/LCKR-a-simulation-backend-interface/) 1. Using [`uiop`](https://asdf.common-lisp.dev/uiop.html#UIOP_002fLAUNCH_002dPROGRAM) to asyncronously have [`emacsclient`](https://www.gnu.org/software/emacs/manual/html_node/emacs/Invoking-emacsclient.html) supplicate the [`emacs server`](https://www.gnu.org/software/emacs/manual/html_node/emacs/Emacs-Server.html) 1. Hence seeing [`eepitch`](https://anggtwu.net/eepitch.html) use our [Leonardo system](/lispgames/LCKR-running-the-simulation/) in real time ## Start the Leonardo system software-individual and load knowledgebase Remembering I committedly include [`cl-series`](https://gitlab.common-lisp.net/rtoy/cl-series/\-/wikis/Series-User's-Guide). Like [over here]("../LCKR-completing-the-simulation") `• (setq inferior-lisp-program "clisp -E ISO-8859-1 -modern")` `• (slime)` `• (setq eepitch-buffer-name "*slime-repl clisp*")` `(require "asdf")` `(merge-pathnames` ` #P"demus/Process/main/"` ` #P"~/leocommunity/Plantworld/")` `(uiop:chdir *)` `(load #P"../../../remus/Startup/cl/acleo.leos")` `(cle)` `. (require :series)` `loadk organisms-kb` `loadk organisms` `loadk plants` `loadk insects` `loadk birds` `loadk sensors` `loadk world` Okay, leonardo system manually engaged. ## Setup the `ECL` and `emacs` side `• (server-start)` `• (setq inferior-lisp-program "ecl")` `• (slime)` `• (setq eepitch-buffer-name "*slime-repl ECL*")` `(require :mcclim)` takes a while (to load the GUI creating stuff) `(in-package :clim-user)` ### Emacs lisp side of automatic eepitching ``` (defun eepitch-send (buffername line) (setq eepitch-buffer-name buffername) (setq line (eepitch-preprocess-line line)) (eepitch-prepare) (eepitch-line line)) ``` ### Common Lisp side of automatic eepitching ``` (defun e-e-str (buffername line) "'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 \\"~a\\")'" buffername line)))) ``` ## Add a common lisp interface manager GUI + interactor ``` (define-application-frame plant-insect-bird-frame () ()) ``` The default interactor is fine, I just want to stick menu commands to it here. `(make-application-frame 'plant-insect-bird-frame)` `(defparameter *pib* *)` ## Some CLIM menu commands ### deluge ``` (define-plant-insect-bird-frame-command (com-deluge :menu t :name t) ((xmin 'number) (xmax 'number) (ymin 'number) (ymax 'number)) (e-e-str "*slime-repl clisp*" (format nil "deluge~@{~^ ~d~}" xmin xmax ymin ymax))) ``` `(run-frame-top-level *pib*)` ...You know what, let's leave that there. By the way, in the clip, autocomplete is assumed when you press enter or space, enter is enter, and abort is `C-g` as you might expect. # Conclusions I am very happy with how this article captured my lisp flow. This adheres to the principle that an intelligent program uses the computer in the same way that an intelligent person would. We made a common lisp interface manager GUI that used our leonardo system software-individual via `launch-program`ming `emacsclient` to `eepitch` to it (which works like-you-typed-it). The `deluge` action is being comprehended by the kernel (imagining the leonardo system + emacs server + eepitch as in your kernel in this case). # Fin. [Talk on the Mastodon!](https://gamerplus.org/@screwlisp/114888938117335951). I'm really, really happy with this useage. If you know someone - and there seem to be a few of them - who want an example of how I am concerned with computers being used, please do tell them that I think this video clip of me working normally is great. You of course have my endorsement to share this how, where and why -ever occurs to you.