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 : 16. Feb 2025, 05:23:30
Autres entêtes
Organisation : SunSITE.dk - Supporting Open source
Message-ID : <m2pljiv7p9.fsf@freecol.be>
References : 1 2 3 4 5 6
User-Agent : Gnus/5.13 (Gnus v5.13) Emacs/25.3.50 (darwin)
Madhu <enometh@meer.net> writes:

* zara <m2tt8wv3gm.fsf@freecol.be> :
Wrote on Fri, 14 Feb 2025 18:30:33 +0100:
>
>
You didn't run it, but it does not just compile in clisp (2019),
it works. SFY.
>
No it is still wrong and it will also fail with Clisp (if clisp does
ansi). it'll fail if you load another file with the same functionn
names.

I ran clisp on NetBSD 10.0 and changed "add" to 'add (See the
dictionary.lisp file below and run it if you please) :

Welcome to GNU CLISP 2.49 (2010-07-07) <http://clisp.cons.org/>

Copyright (c) Bruno Haible, Michael Stoll 1992, 1993
Copyright (c) Bruno Haible, Marcus Daniels 1994-1997
Copyright (c) Bruno Haible, Pierpaolo Bernardi, Sam Steingold 1998
Copyright (c) Bruno Haible, Sam Steingold 1999-2000
Copyright (c) Sam Steingold, Bruno Haible 2001-2010

Type :h and hit Enter for context help.

[1]> (load "./dictionary.lisp")
;; Loading file ./dictionary.lisp ...
(0 255)
;; Loaded file ./dictionary.lisp
T
[2]>

Bye.

;; Here's the working dictionary.lisp file :
;;
;; -- 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 --
;;

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