chicken-hackers
[Top][All Lists]
Advanced

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

Re: [Chicken-hackers] CR: (#439) quasiquote changes


From: Thomas Chust
Subject: Re: [Chicken-hackers] CR: (#439) quasiquote changes
Date: Fri, 10 Dec 2010 12:27:51 +0100

2010/12/8 Peter Bex <address@hidden>:
> [...]
> I find this _very_ weird.  It feels as if they made (+ (values 1 2 3))
> be identical to (+ 1 2 3) - sorry if that's a weird analogy, but it's
> exactly the same to my brain.

Hello,

to me the analogy seems quite well chosen. By the way, sometimes I
actually wonder whether splicing behaviour of multiple values in an
argument list wouldn't be a good idea, but I'm unsure.

> [...]
> Quasiquote itself is not allowed to have multiple arguments,
> which is also a bit inconsistant (but logical).  Racket does allow
> multiple nested arguments to quasiquotes.  I haven't been able to test
> with any other r6rs Scheme because Racket is the only one available in
> pkgsrc and I'm not willing to mess around with building one from source.
> Extra data points would be appreciated if someone else reading this
> happens to have another r6 implementation at hand.
> [...]

Here are the results with two other R6RS implementations:

  Petite Chez Scheme 8.0:

    > (let ([a 0] [b 1] [c 2])
        (quasiquote ((unquote a b c))))
    (0 1 2)

    > (let ([a 0] [b 1] [c 2])
        (quasiquote (unquote a b c)))
    (unquote a b c)

    > (let ([a 0] [b 1] [c 2])
        (quasiquote (quasiquote (unquote a b c))))
    `(unquote a b c)

    > (let ([a 0] [b 1] [c 2])
        (quasiquote (unquote a) (unquote b) (unquote c)))
    Exception: invalid syntax (quasiquote (unquote a) (unquote b) (unquote c))

  Ypsilon 0.9.6-update3

    > (let ([a 0] [b 1] [c 2])
        (quasiquote ((unquote a b c))))
    (0 1 2)

    > (let ([a 0] [b 1] [c 2])
        (quasiquote (unquote a b c)))

    error in quasiquote: unquote appear in bad context

      >  `(unquote a b c)
      ..."/dev/stdin" line 2
      @  (unquote a b c)
      ..."/dev/stdin" line 2

    > (let ([a 0] [b 1] [c 2])
        (quasiquote (quasiquote (unquote a b c))))
    `(unquote a b c)

    > (let ([a 0] [b 1] [c 2])
        (quasiquote (unquote a) (unquote b) (unquote c)))
    0

I'd say, the behviour is not exactly consistent between
implementations.

Ciao,
Thomas


-- 
When C++ is your hammer, every problem looks like your thumb.



reply via email to

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