[racket] unstable/match

From: Brian Mastenbrook (brian at mastenbrook.net)
Date: Tue Oct 11 15:34:00 EDT 2011

On 10/11/2011 02:19 PM, Eli Barzilay wrote:
> 10 minutes ago, Sam Tobin-Hochstadt wrote:
>> I don't plan to change it, but I do plan to move it to `racket/match'.
>
> Instead of a new keyword, why not use `equal?'?  You can then define
> the others instead of the extra `comparator'.  Alternatively, I think
> that `==' is a bad name, which looks confusing in useful cases like
>
>    (== 3 =)
>    (== 10<)
>
> and I think that the order of compared arguments should change, so
> the last one matches things that are smaller than 10, and things like
> `memq' can be used too.  Something like
>
>    (?? 3 =)
>    (?? 10<)
>    (?? memq '(1 2 3))
>

(?? x) looks a bit funny, doesn't it? Would you get rid of the implicit 
comparator? And I think you meant (?? '(1 2 3) memq) in the third 
example, or for the others to be reversed to be more similar to the ? 
pattern.

Personally I think that == is a fine name; reversing the order of the 
operands to the comparator probably makes sense and wouldn't affect me 
at all.

-- 
Brian Mastenbrook
brian at mastenbrook.net
http://brian.mastenbrook.net/



Posted on the users mailing list.