Rick Hanson <cryptor...@gmail.com> writes:

> Yeah, sorry.  I had this on the mind -- a different animal altogether.
>
>   $ sbcl
>   * (let ((X (+ 3 4))) `(hello ,X ,(- X 9)))
>   (HELLO 7 -2)

Maybe I was confused by Emacs Lisp a bit too:

,----
| (let ((x (+ 3 4))
|       (y (+ 5 6)))
|   `(+ 5 x ,y))
| 
| -> (+ 5 x 11)
`----

> Thanks, Alex, for taking the time and writing a very nice explanation.
> I believe I understand it, but I will re-read and ponder it more.

1+
Many thanks for that in detail explanation, its actually a bit confusing
especially when one is used to other Lisps too.  

When I quote the reference:

,----
| A single backquote character "`" will cause the reader to evaluate
| the following expression, and return the result.
| 
| : '(a `(+ 1 2 3) z)
| -> (a 6 z)
| 
| A tilde character ~ inside a list will cause the reader to evaluate
| the following expression, and (destructively) splice the result into
| the list.
| 
| : '(a b c ~(list 'd 'e 'f) g h i)
| -> (a b c d e f g h i)
`----

it looks to me as if the difference between PicoLisp and others (like
Emacs Lisp) must be rather in the 'let than in the read macros, since
the combination "quote/backquote" in PicoLisp is equivalent to the
combination "backquote/comma" in other Lisps, and works the same, except
inside let bindings:

PicoLisp:

,----
| $ pil +
| : (let X (+ 2 3) '(3 4 `X))
| -> (3 4 NIL)
| : '(3 4 `(+ 2 3))
| -> (3 4 5)
`----

vs Emacs Lisp:

,----
| (let ((X (+ 2 3))) `(3 4 ,X))
| -> (3 4 5)
| 
| `(3 4 ,(+ 2 3))
| -> (3 4 5)
`----

How would the above behavior inside let bindings be achieved in
PicoLisp? 


-- 
cheers,
Thorsten

-- 
UNSUBSCRIBE: mailto:picolisp@software-lab.de?subject=Unsubscribe

Reply via email to