[plt-scheme] On hygiene and trust

From: Joe Marshall (jmarshall at alum.mit.edu)
Date: Thu Jul 9 17:06:22 EDT 2009

I wrote:
>> (define-syntax foo
>>   (lambda (stx)
>>     (if (lambda-expression? (first-argument stx))
>>         ....)))

On Thu, Jul 9, 2009 at 12:28 PM, Eli Barzilay<eli at barzilay.org> wrote:
> You still get that:
>
>  > (define-syntax (foo stx)
>      (if (free-identifier=? #'lambda (stx-car (stx-cdr stx)))
>        #'1
>        #'2))

But I want
  (if (eq? 'lambda (cadr stx)) 1 2)

I know it isn't the same (because of the extra baggage of syntax objects)
but it is essentially isomorphic (modulo doing funny things with scope), so
why do I have to learn a whole new set of primitives?

> Sorry, I just don't see how that's different than using `map' over a
> string, for example...  Maybe it's the fact that you choose to accept
> the extra complexity with strings because you see a point in having it
> be a different type, but for some reason you refuse to divorce syntax
> from lists in the same way?

Map works fine on strings in common lisp.

But strings aren't isomorphic to lists.  Code is.

-- 
~jrm


Posted on the users mailing list.