#+TITLE: 014/100 interactive lisp slime life in plain text
#+AUTHOR: screwtape
#+EMAIL:
[email protected]
* Preamble
0. This preamble changes to orgmode and locally caches a gopher buffer.
1. Do M-x org-mode ; alt-x org-mode <RET>
2. put the cursor anywhere in the src block below and press C-c C-c and say yes
#+name: cache-this-phlog
#+HEADER: :var phlogs-dir="/tmp/phloggersgarage/"
#+HEADER: :var phlog-server="tilde.club/"
#+HeADer: :var phlog-dir="~screwtape/synthember-100days-tooffload/"
#+HEADER: :var this-phost-title="014-interactive-slime-life.org"
#+begin_src elisp :results none
(let* ((tmp-directory
(cl-concatenate 'string phlogs-dir phlog-server phlog-dir))
(tmp-file-name (cl-concatenate 'string tmp-directory this-phost-title)))
(make-directory tmp-directory t)
(set-visited-file-name tmp-file-name)
(save-buffer (current-buffer))
(find-file tmp-file-name))
#+end_src
3. Join #phloggersgarage in libera.chat while enjoying cached org-mode gopher
100daystooffload
4. customize the header :var whatever="stri/ngs" for your own phosts
* Bongusta phlog aggregator by logout
[[
gopher://i-logout.cz/1/bongusta/]]
Hints:
- M-x elpher-copy-link-url ; I always forget this after elpher-go. Also ^ is back
- C-c C-l C-y <RET> <RET> ; enter a link that displays as just the url
* THIS PHLOG AS SUCH :actually_the_phlog:
** SLIME LISP CLOS
is an ANSI standard extending the lisp standard to present and accept
interactions by means other than simply a character stream.
The open source child of clim is named McCLIM and it's over here:
[[
https://codeberg.org/McCLIM]]
OR SO I PLANNED but instead this is a sm0l introduction to programming
in lisp at all and with an orgmode slime session, and clos
particularly.
*** Start slime
#+name: slime
#+begin_src elisp
(slime)
#+end_src
*** Writing a package without clim
Actually, I'm not sure how to start slime without opening a window
that needs to be closed (C-x 5 0).
I believe slime includes loading the inferior lisp's asdf
implementation so we don't have to (require :asdf).
Here I'm learning myself, and I know that I want clim to make the
interface, rather than trying to fiddle it myself.
So I'm thinking something like a list of counts and names that
I can #'pairlis together. Something like this
#+name: pairlis
#+begin_src lisp
(defvar *counts* '(0 0 0))
(defvar *names* '(a b c))
#+end_src
sorry about the vulgar style. I often like to just setq like this when
I'm just noodling. Then maybe we would like to #'incf a count based on
a name.
#+name:incf-by-name
#+HEADER: :noweb yes :results none
#+begin_src lisp
<<pairlis()>>
(Defun incf-by-name (name)
(let ((idx (search `(,name) *names*)))
(when idx (incf (car (nthcdr idx *counts*))))))
#+end_src
I tried to use noweb to inline having called whatever pairlis() was
for the side effect. #'defvar means multiple calls to that don't reset
their value. Now maybe a function for using that that takes an arg
#+name: %increase-name
#+HEADER: :var count-name=()
#+begin_src lisp
(incf-by-name count-name)
#+end_src
this should just work right? call_%increase-name(count-name='a) {{{results(=3=)}}}
#+CALL: %increase-name(count-name='a)
#+RESULTS:
: 2
#+CALL: %increase-name(count-name='b)
#+RESULTS:
: 1
there isn't really a cute way to turn that special scope stuff into a
class, so I'm just quickly rewriting it.
**** name-count class
#+name: defining-name-count-class
#+begin_src lisp
(defclass named-counts ()
((count-names :initarg :count-names :Type 'list :accessor count-names)
(counts-of :initarg :initial-counts-of :Type 'list :Accessor counts-of)))
(defmethod increase-name ((name symbol) (obj named-counts))
(let ((idx (search `(,name) (count-names obj))))
(when idx (incf (car (nthcdr idx (counts-of obj)))))))
;;Oh let's just make a special one (like how *application-frame* will be special)
(defvar *named-counter*
(make-instance 'named-counts
:count-names '(a b c)
:initial-counts-of '(-3 -2 -1)))
#+end_src
#+RESULTS: defining-name-count-class
: #<NAMED-COUNTS {1003904183}>
and the actual
#+name: increase-name
#+header: :var count-name=()
#+begin_src lisp
(increase-name count-name *named-counter*)
#+end_src
with the example named-counter. #+call_increase-name(count-name='c) {{{results(=2=)}}}
#+CALL: increase-name(count-name='b)
#+RESULTS:
: -1
We did some programming. I am thinking of using something like this with derangements later.
Let's see about graphicalising this.
*** require mcclim
OKAY I forgot that McCLIM also uses swank so we need to start slime using McCLIM's swank.
I feel like this phost went on a bit, so let's leave slime clim to the next one.
* Cached plugd's pgbot 100daystooffloadroll :appendix:
| screwtape | [[
gopher://tilde.club/1/~screwtape/synthember-100days-tooffload/]] |
| matto | [[
gopher://box.matto.nl]] |
| _82mhz | [[
https://82mhz.net]] |
| plugd | [[
gopher://thelambdalab.xyz/1phlog/]] |
| x1v | [[
gopher://rawtext.club/1/~xiu/phlog/]] |
| szczezuja | [[
gopher://gopher.club:70/1/users/szczezuja/personal/]] |
| prahou | [[
gopher://triapul.cz/1/phlog]] |
| pi31415 | [[
gopher://tilde.pink/1/~bencollver/log/]] |
| damarusama | [[
gopher://gopher.club/1/users/gef/]] |
* Also cat and jns and pkw and screwtape
| [[
gopher://baud.baby]] | [[
gopher://embryonic.church]] |
| [[
gopher://gopher.linkerror.com]] | [[
gopher://gopher.club/1/users/jns/]] |
| [[
gopher://g.d34d.net/1/~pkw/]] |
gopher://gopher.club/1/users/screwtape/ |