[plt-scheme] ocaml-style match

From: Jon Rafkind (rafkind at cs.utah.edu)
Date: Mon Apr 5 17:24:53 EDT 2010

Well I used `list-rest' in the implementation so I'm pretty sure I know 
about it :p

Anyway, I like :: syntax for some reason.

On 04/05/2010 03:23 PM, Chongkai Zhu wrote:
> Why not just use:
>
> (match '(1 2 3 4)
>  [(list-rest a b c)
>
> Chongkai
>
> Jon Rafkind wrote:
>> Here is `list-match' which gives you ocaml-style matching.
>>
>> (list-match '(1 2 3 4)
>>   [(a :: b :: c) (and
>>                    (equal? a 1)
>>                    (equal? b 2)
>>                    (equal? c '(3 4)))])
>>
>> More examples in the implementation.
>> ------------------------------------------------------------------------
>>
>> _________________________________________________
>>   For list-related administrative tasks:
>>   http://list.cs.brown.edu/mailman/listinfo/plt-scheme
>



Posted on the users mailing list.