[plt-scheme] quasiquote?

From: Joe Marshall (jrm at ccs.neu.edu)
Date: Tue Jan 13 09:57:12 EST 2004

"Dor Kleiman" <dor at ntr.co.il> writes:

> From Revised^5 Report on the Algorithmic Language Scheme:
> "If a comma appears followed immediately by an at-sign (@), then the
> following expression must evaluate to a list"
> A list, I believe, always refers to a proper list - otherwise it's not a
> list, it's just a pair. Therefore, when using `(1 ,@(2 . 3)) it should
> not work, but should raise an error.

Yes, but I consider `(1 ,@'(2 . 3)) to be shorthand for

(cons 1 '(2 . 3)) or perhaps 
(cons 1 (append '(2 . 3)))

I agree it should be an error in this case:

   `(1 ,@'(2 . 3) foo)



> Dor
>
> -----Original Message-----
> From: Joe Marshall [mailto:jrm at ccs.neu.edu] 
> Sent: Tuesday, January 13, 2004 4:16 PM
> To: Doug Orleans
> Cc: plt-scheme at list.cs.brown.edu
> Subject: Re: [plt-scheme] quasiquote?
>
>   For list-related administrative tasks:
>   http://list.cs.brown.edu/mailman/listinfo/plt-scheme
>
> Doug Orleans <dougo at place.org> writes:
>
>>   For list-related administrative tasks:
>>   http://list.cs.brown.edu/mailman/listinfo/plt-scheme
>>
>> Ken Anderson writes:
>>  > I now see that args must be a list, which i assume means a proper
> list.
>>  > 
>>  > At 11:37 AM 1/7/2004 -0500, Ken Anderson wrote:
>>  > >> (define name 'sscanf)
>>  > >> (define args '(string format-string . args))
>>  > >> `(,name . ,args)
>>  > >(sscanf string format-string . args)
>>  > >> `(,name , at args)
>>  > >. append: expects argument of type <proper list>; given (string
> format-string . args)
>>  > >>
>>  > >
>>  > >>From my experience with Common Lisp i expected the two quasiquote
> expressions to print the same.   Am i doing somethine wrong in Scheme or
> is this a bug?
>>  > >I'm using  200alpha12 (iteration 0)
>>
>> Coincidentally, I just ran into the same limitation: unquote-splicing
>> only works on proper lists.  (Actually the one I ran into was
>> unsyntax-splicing.)  R5RS only says its argument "must evaluate to a
>> list", but it doesn't say proper list-- or is this always implied by
>> the spec?  Anyway, is there a good reason not to extend it to work on
>> improper lists as well?
>
> I'd call it a bug.  



Posted on the users mailing list.