Re: A try on condp (was: Re: proposal: match multimethod)

2008-12-05 Thread Meikel Brandmeyer
Hi, Am 04.12.2008 um 10:44 schrieb Meikel Brandmeyer: I almost whipped this up yesterday, but I got sidetracked thinking about how best to provide a feature like Scheme's cond's =>. Do you know it? It feeds the value of the test to the fn on the rhs of the clause. It can be useful. It seems my

Re: A try on condp (was: Re: proposal: match multimethod)

2008-12-04 Thread Meikel Brandmeyer
Hello Rich, On 4 Dez., 02:30, Rich Hickey <[EMAIL PROTECTED]> wrote: > needle is a strange name - what's the origin? expr is probably better. I thought of it as needle, which we search in the haystack. But this comparison is not very good after a second thought. Changed needle to expr. > I thin

Re: A try on condp (was: Re: proposal: match multimethod)

2008-12-03 Thread Rich Hickey
On Dec 3, 2:51 pm, Meikel Brandmeyer <[EMAIL PROTECTED]> wrote: > Hi Stuart and Rich, > > Am 03.12.2008 um 19:00 schrieb Stuart Sierra: > > >> I'm pretty sure I don't like the sound of that at all. We had a nice > >> discussion about fcase/condf, which I'd like to get in, here: > > >>http://grou

Re: A try on condp (was: Re: proposal: match multimethod)

2008-12-03 Thread Meikel Brandmeyer
Hi, Am 03.12.2008 um 21:10 schrieb Brian Doyle: Can you include an example usage of this function? Thanks. (condp = x 1 "We got a one." 2 (str "We got a " (- 3 1)) "We got something else.")) Sincerely Meikel smime.p7s Description: S/MIME cryptographic signature

Re: A try on condp (was: Re: proposal: match multimethod)

2008-12-03 Thread Meikel Brandmeyer
Hello again, Am 03.12.2008 um 20:51 schrieb Meikel Brandmeyer: cls (mapcat (fn [[x c]] `[(~xprd ~xndl ~x) ~c]) (partition 2 cls)) xndl (gensym "condp_needle__") xprd (gensym "condp_predicate__") Oops. These should of course be changed to be in the right order. Sincerel

Re: A try on condp (was: Re: proposal: match multimethod)

2008-12-03 Thread Brian Doyle
Can you include an example usage of this function? Thanks. On Wed, Dec 3, 2008 at 12:51 PM, Meikel Brandmeyer <[EMAIL PROTECTED]> wrote: > Hi Stuart and Rich, > > Am 03.12.2008 um 19:00 schrieb Stuart Sierra: > >> I'm pretty sure I don't like the sound of that at all. We had a nice >>> discussio

A try on condp (was: Re: proposal: match multimethod)

2008-12-03 Thread Meikel Brandmeyer
Hi Stuart and Rich, Am 03.12.2008 um 19:00 schrieb Stuart Sierra: I'm pretty sure I don't like the sound of that at all. We had a nice discussion about fcase/condf, which I'd like to get in, here: http://groups.google.com/group/clojure/browse_frm/thread/ dee910bef629... And I haven't forgott

Re: proposal: match multimethod

2008-12-03 Thread Stuart Sierra
On Dec 2, 2:08 pm, Rich Hickey <[EMAIL PROTECTED]> wrote: > I'm pretty sure I don't like the sound of that at all. We had a nice > discussion about fcase/condf, which I'd like to get in, here: > > http://groups.google.com/group/clojure/browse_frm/thread/dee910bef629... And I haven't forgotten abo

Re: proposal: match multimethod

2008-12-03 Thread axo...@gmail.com
On Dec 2, 2:08 pm, Rich Hickey <[EMAIL PROTECTED]> wrote: > On Dec 2, 12:16 pm, Stuart Halloway <[EMAIL PROTECTED]> wrote: > > 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 ag

Re: proposal: match multimethod

2008-12-02 Thread Martin DeMello
On Dec 2, 9:22 pm, Rich Hickey <[EMAIL PROTECTED]> wrote: > > For those of us that don't do Ruby - what does === do? It's a supporting method for the case keyword case object when pred1: action1 when pred2: action2 .. end translates to if pred1 === object action1 elsif pred2 === object act

Re: proposal: match multimethod

2008-12-02 Thread Rich Hickey
On Dec 2, 12:16 pm, Stuart Halloway <[EMAIL PROTECTED]> wrote: > 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

Re: proposal: match multimethod

2008-12-02 Thread Stuart Halloway
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 string

Re: proposal: match multimethod

2008-12-02 Thread Rich Hickey
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. >

proposal: match multimethod

2008-12-01 Thread Stuart Halloway
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? Stuart --~--~--