Re: nit picking

From: Erick Gallesio <eg_at_saxo.essi.fr>
Date: Wed, 23 Apr 1997 16:48:03 +0200

> David Fox wrote
>
> About quasi-quote splicing - the standard prohibits a dotted list as
> the argument to something like

That's true and I have missed that!!
>
> STk> `(a b ,_at_'(c . d))
> => (a b c . d)
>
> probably because of cases like this
>
> STk> `(a b ,_at_'(c . d) e)
> => (a b c e)
>

Yes, this is weird at first sight (but not so at second one ;-).

Amazingly, I have tested the following expressions on various implementations
(Lisp or Scheme)
        (define l (cons 3 4))
        `(1 2 ,_at_l)
        `(1 2 ,_at_l 5)

and here are the results

                `(1 2 ,_at_l) `(1 2 ,_at_l 5)
-----------------------------------------------------
Bigloo Error Error
CLISP (1 2 3 . 4) (1 2 3 5)
Elk (1 2 3) (1 2 3 5)
GCL (1 2 3 . 4) Error
Guile Error Error
MIT Scheme (1 2 3 . 4) Error
MzScheme (1 2 3 . 4) Error
SCM 4e1 (1 2 3) (1 2 3 5)
SCM 4e4 Error Error
STk (1 2 3 . 4) (1 2 3 5)
Scheme->C Error Error
Scheme48 (1 2 3 . 4) Error


By testing more implementations, it could be possible to find
all combinations :-)

> However, the behavior in the first example is used in STklos to
> create the list of formals for a method. I just thought you might
> be interested in this.

I will not change, the implementation of backquote since some program
could rely on this "feature" but that's clear that, I should not use it
myself. As you said this is used for formals of a method.
Rewriting method with the following macro should work

  (define-macro (method args . body)
    (let ((decomposition (build-specializers-list args)))
      `(make <method>
             :specializers ',(car decomposition)
             :procedure (lambda ,(cons 'next-method (cdr decomposition))
                             ,_at_body))))

I think this is the only place this "feature" is used (at least in stklos.stk).



                -- Erick
Received on Wed Apr 23 1997 - 16:46:00 CEST

This archive was generated by hypermail 2.3.0 : Mon Jul 21 2014 - 19:38:59 CEST