It is called "case equality" which is a terribly confusing way to say  
"the predicate used  to match in case statements". "Match" is really  
the best verb.  In Ruby, most things match by value equality. But  
classes match their instances. Ranges match things in the range.  
Regexps match strings that they would match against.

I find the construct useful, but difficult to define. In particular,  
if regular expressions match against matching strings, should  
collections match against their members? Subsets?

The use case I have in mind for Clojure is in unit tests, where one  
might say something like

(each-matches
        [actual-value expected-value]+)

and have the match operator applied.

Stuart

> On Dec 1, 5:07 pm, Stuart Halloway <[EMAIL PROTECTED]> wrote:
>> I am thinking about adding a match method to Clojure-contrib. This
>> would work like Ruby's threequals ("===", a.k.a. case equality) and
>> would be implemented as a multimethod to do sensible things with a
>> wide variety of types.
>>
>> (1) Good idea?
>>
>> (2) What should it be named?
>>
>
> For those of us that don't do Ruby - what does === do?
>
> Rich
>
> >


--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups 
"Clojure" group.
To post to this group, send email to clojure@googlegroups.com
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/clojure?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to