[plt-scheme] Re: plt-scheme Digest, Vol 5, Issue 14

From: Matthias Felleisen (matthias at ccs.neu.edu)
Date: Fri Jan 6 17:34:44 EST 2006

On Jan 6, 2006, at 2:45 PM, Bill Wood wrote:
> I'm finding the separation of the functor from the args of the clause
> head unnerving.  This syntax seems almost to be an intermediate form a
> compiler might build after finding all the clauses for a given
> functor/arity pair.  But hey, we lispers are happy with S expressions,
> which were originally intended to be essentially ASTs for a more
> conventional surface syntax.

The constructor is indeed separated but just like f is separated from
x in (f x). What do you mean?

If you are referring to the ability to define and redefine your own
constructor, this increases the power of Prolog: you can match against
vectors, S-expressions, ref cells, etc.

This is from the manual:

 > (which (x) (%add 0 (succ x) (succ x)))
((x _))

Now I define a different constructor:

 > (define (succ x) `(succ ,x))
 > (which (x) (%add 0 (succ x) (succ x)))
((x _))

This is neat! What's wrong? -- Matthias

Posted on the users mailing list.