[plt-scheme] Another pattern puzzle

From: Jens Axel Soegaard (jensaxel at soegaard.net)
Date: Thu Nov 15 08:00:25 EST 2007

Matthew Flatt skrev:
> At Thu, 15 Nov 2007 13:41:11 +0100, Jens Axel Soegaard wrote:
>> An identifier matches a list pattern:
>>
>>    > (syntax-case #'x ()
>>        [(a ... . more) 'huh?]
>>        [_              'ok])
>>
>>    huh?
> 
> It's not really a "list" pattern, though; it matches N chained cons
> cells ending with something that matches `more', and `more' isn't
> required to be a list.
> 
> So, #'x matches a chain of 0 cons cells ending with a match to `more'.

I have always thought of it in terms of the elements - the result
makes sense, when you think of cons cells instead.

--
Jens Axel Søgaard



Posted on the users mailing list.