chicken-users
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [Chicken-users] quasiquote, unquote-splicing and cons cells


From: Zbigniew
Subject: Re: [Chicken-users] quasiquote, unquote-splicing and cons cells
Date: Sat, 5 Jan 2008 15:10:51 -0600

Hans,

If I understand correctly, you're asking whether this is valid:

`(,@'() . x)  ;=> x

According to Quasiquotation in Lisp (Alan Bawden), "... the most
useful expansion of `(,@anything) is (append anything).  So in order
to give nested splicing a useful semantics, the code constructed by
read for a quasiquotation makes ... anything that follows a
comma-atsign (,@) into an argument to append."

#;2> ,x `(,@'() . x)
(##sys#append '() 'x)

My reading of the quasiquotation parser code in that paper indicates
to me it behaves in that way--although I didn't test it out.

So, I think you're on solid ground.  If you want to be absolutely sure
then check out the paper or contact a quasiquotation expert (operators
are standing by!)

On Jan 5, 2008 8:48 AM, Hans Bulfone <address@hidden> wrote:
> hi,
>
> in a macro i'm constructing a lambda-list in the following way:
>
> `(,@rqd-args . ,rest-arg)
>
> there are 3 cases:
>
> 1. (let ((rqd-args '(a b c)) (rest-arg 'r)) `(,@rqd-args . ,rest-arg))
>    ==> (a b c . r)
>
> 2. (let ((rqd-args '(a b c)) (rest-arg '())) `(,@rqd-args . ,rest-arg))
>    ==> (a b c)
>
> so far so good, nothing special... but:
>
> 3. (let ((rqd-args '()) (rest-arg 'r)) `(,@rqd-args . ,rest-arg))
>    ==> r
>
> this is exactly how i hoped it to be, but the question is if this
> is actually allowed or if it just works "accidentally".
> r5rs doesn't seem to specify this case and '( . x) is not allowed.
>
> i've tried the same expression with guile and sbcl and it worked
> there as well but i'm still not sure if i should use it.
>
> any opinions?
>
> tnx&bye,
> hans.
>
>
> _______________________________________________
> Chicken-users mailing list
> address@hidden
> http://lists.nongnu.org/mailman/listinfo/chicken-users
>




reply via email to

[Prev in Thread] Current Thread [Next in Thread]