Puzzled by SBCL evaluating some Scheme code

Liste des GroupesRevenir à cl lisp 
Sujet : Puzzled by SBCL evaluating some Scheme code
De : mail (at) *nospam* axel-reichert.de (Axel Reichert)
Groupes : comp.lang.lisp
Date : 27. Mar 2024, 08:23:38
Autres entêtes
Organisation : A noiseless patient Spider
Message-ID : <87o7b08a6t.fsf@axel-reichert.de>
User-Agent : Gnus/5.13 (Gnus v5.13) Emacs/28.2 (gnu/linux)
Hello,

I am playing a bit with Guile and proceed along

  https://scheme.com/tspl4/start.html#./start:h2

In a Scheme, exercise 2.2.3o

  ((car (list + - * /)) 2 3)

evaluates to 5. Of course, in Common Lisp this has to be written as

  (funcall (car (list (function +)
                      (function -)
                      (function *)
                      (function /)))
           2 3)

or, using reader macros, as

  (funcall (car (list #'+ #'- #'* #'/)) 2 3)

or even, but not strictly identical anymore,

  (funcall (car '(+ - * /)) 2 3)

However, at one point I managed to paste an expression into the wrong
REPL, SBCL instead of Guile, and got

  (list + - * /)

evaluated by SBCL as

  (NIL (LIST + - * /) NIL NIL)

Oops?! Even better, when I tried this again immediately, I got

  ((LIST + - * /) (LIST + - * /) (NIL (LIST + - * /) NIL NIL)
   ((NIL (LIST + - * /) NIL NIL)))

So there seems to be some "history expansion" going on (for "*"). But
how to explain the first result with the NILs and the expression itself?

Pointers welcome!

Axel

Date Sujet#  Auteur
27 Mar 24 * Puzzled by SBCL evaluating some Scheme code3Axel Reichert
27 Mar 24 `* Re: Puzzled by SBCL evaluating some Scheme code2Kaz Kylheku
27 Mar 24  `- Re: Puzzled by SBCL evaluating some Scheme code1Axel Reichert

Haut de la page

Les messages affichés proviennent d'usenet.

NewsPortal