Re: lisp-sound v0.2.1

Liste des GroupesRevenir à cl lisp 
Sujet : Re: lisp-sound v0.2.1
De : johan (at) *nospam* freecol.be (zara)
Groupes : comp.lang.lisp
Date : 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

Date Sujet#  Auteur
10 Feb 25 * lisp-sound v0.2.114zara
10 Feb 25 `* Re: lisp-sound v0.2.113Kaz Kylheku
11 Feb 25  +- Re: lisp-sound v0.2.11Madhu
14 Feb 25  `* Re: lisp-sound v0.2.111zara
14 Feb 25   `* Re: lisp-sound v0.2.110Kaz Kylheku
14 Feb 25    `* Re: lisp-sound v0.2.19zara
16 Feb 25     +* Re: lisp-sound v0.2.15Madhu
16 Feb 25     i`* Re: lisp-sound v0.2.14zara
16 Feb 25     i +- Re: lisp-sound v0.2.11Madhu
16 Feb 25     i `* Re: lisp-sound v0.2.12tpeplt
16 Feb 25     i  `- Actor object System in LISP without CLOS (dictionary example) - was Re: lisp-sound v0.2.11zara
17 Feb 25     `* Re: lisp-sound v0.2.13Kaz Kylheku
17 Feb 25      `* Re: lisp-sound v0.2.12zara
17 Feb 25       `- Re: lisp-sound v0.2.11Kaz Kylheku

Haut de la page

Les messages affichés proviennent d'usenet.

NewsPortal