[plt-scheme] probably dumb question, but...
,a
is, at read time, expanded into:
(unquote a)
They are identical by the you get to the macro expander, etc. Note that
reader macros aren't expanded inside ""s or inside ||s.
So, it may become clearer if you go back thru your examples and
substitute (unquote a) for everything.
After that, try this one:
(define funny
(lambda ,a
(let (,a) ,a)))
(funny funny values)
Moral: yes, Scheme can be as wacky (for no good reason) as any other
language.
Robby
At Mon, 03 Jan 2005 14:33:44 -0500, Psy-Kosh wrote:
> For list-related administrative tasks:
> http://list.cs.brown.edu/mailman/listinfo/plt-scheme
>
> I was messing around a bit, and discovered something... odd.
>
> consider the following:
>
> Welcome to DrScheme, version 209.
> Language: Textual (MzScheme, includes R5RS).
> > ;this is expected:
> > ,a
> unquote: not in quasiquote in: (unquote a)
> > ;the rest of this confuses me:
> > ',a
> ,a
> > (symbol? ',a)
> #f
> > (eq? ',a ',a)
> #f
> > (eqv? ',a ',a)
> #f
> > (equal? ',a ',a)
> #t
> > ;hrm, but even though it's not a symbol...
> > (define ,a 37)
> > ,a
> . reference to undefined identifier: a
> > a
> . reference to undefined identifier: a
> > |,a|
> . reference to undefined identifier: |,a|
> > ;so ,a doesn't produce an unquote not in quasiquote error anymore,
> but there doesn't seem to be any way to extract the 37 from wherever it is
> > (set ,a 26)
> . reference to undefined identifier: set
> > ;typo
> > (set! ,a 26)
> set!: not an identifier in: (unquote a)
> > ;but...
> > (define ,a 26)
> > ;but... but... aren't later defines defined to act equivalently to set! ?
> >
>
> okay, so what exactly is ,a? why if it's not a symbol, why can it be
> used as an identifier for the purposes of define? why not for set! ?
>
> Psy-Kosh