Sujet : Re: lisp-sound v0.2.1
De : johan (at) *nospam* freecol.be (zara)
Groupes : comp.lang.lispDate : 14. Feb 2025, 14:56:35
Autres entêtes
Organisation : SunSITE.dk - Supporting Open source
Message-ID : <m25xlcbpf0.fsf@freecol.be>
References : 1 2
User-Agent : Gnus/5.13 (Gnus v5.13) Emacs/25.3.50 (darwin)
Here's the example of the dictionary actor without CLOS :
;;
;; -- start of file --
;;
(defun make-dictionary ()
(let ((*dict ()))
(defun add (value)
(setq *dict (append *dict (list (length *dict) value))))
(defun get-with-index (index)
(let ((*index 0))
(loop for el in *dict
do (if (= (car el) index)
(return (cadr el))
(setq *index (+ 1 *index)))
(return ()))))
(defun dispatch (msg)
(cond ((eq msg 'add) #'add)
((eq msg 'get-with-index) #'get-with-index)
(T (print "make-dictionary : Message not understood"))))
#'dispatch))
;; tests
;(setf dictionary (make-dictionary))
;(print (funcall (funcall dictionary "add") 255))
;;
;; -- end of file --
;;
I had to change two parens to make it compile.
The tests ran in clisp in 2019.
zara
-- My software & art company : http://ko-fi.com/brandywine9