Re: destructuring/multimethods vs. pattern matching

2008-10-20 Thread Stuart Halloway
> What are your concerns re: apply? Are there performance issues? Or is > it not being able to call qsort on a collection directly? I just want the code to look pretty, no deeper concerns than that. :-) --~--~-~--~~~---~--~~ You received this message because you

Re: destructuring/multimethods vs. pattern matching

2008-10-20 Thread Achim Passen
Hi Stuart, Am 20.10.2008 um 20:00 schrieb Stuart Halloway: > Nice--I like this one, except for needing to apply. What I really want > is arity overloading *within* the first argument, which is what led me > down the path to multimethods. Yes, sadly arity matching is only available at the top le

Re: destructuring/multimethods vs. pattern matching

2008-10-20 Thread Martin DeMello
On Oct 20, 10:43 am, Stuart Halloway <[EMAIL PROTECTED]> wrote: > Hi Steve, > > Thanks! I like quicksort-4. It all fixes a problem that bugged me in   > all the other examples, which is that "bigger" is a lie. The real   > semantic is "not smaller", which quicksort-4 captures perfectly. > > I will

Re: destructuring/multimethods vs. pattern matching

2008-10-20 Thread Stuart Halloway
Hi Achim, Nice--I like this one, except for needing to apply. What I really want is arity overloading *within* the first argument, which is what led me down the path to multimethods. Is there a reason to prefer concat over lazy-cat here? Cheers, Stuart > Hi! > > Here's a variadic version:

Re: destructuring/multimethods vs. pattern matching

2008-10-20 Thread Stuart Halloway
Hi Steve, Thanks! I like quicksort-4. It all fixes a problem that bugged me in all the other examples, which is that "bigger" is a lie. The real semantic is "not smaller", which quicksort-4 captures perfectly. I will have to get used to thinking of "remove" as the opposite of "filter." The

Re: destructuring/multimethods vs. pattern matching

2008-10-20 Thread Achim Passen
Hi! Here's a variadic version: (defn qsort ([] []) ([x & xs] (concat (apply qsort (filter #(< % x) xs)) (cons x (apply qsort (filter #(>= % x) xs)) user> (qsort 1234 56 789 0) (0 56 789 1234) Kind regards, achim Am 2

Re: destructuring/multimethods vs. pattern matching

2008-10-20 Thread Stephen C. Gilardi
On Oct 20, 2008, at 11:16 AM, Stuart Halloway wrote: > Hi all, > > I seem to recall Rich saying "I like the destructuring part of pattern > matching." In my efforts to appreciate that statement, I am playing > around with porting simple Haskell examples to Clojure, trying to use > destructuring (

destructuring/multimethods vs. pattern matching

2008-10-20 Thread Stuart Halloway
Hi all, I seem to recall Rich saying "I like the destructuring part of pattern matching." In my efforts to appreciate that statement, I am playing around with porting simple Haskell examples to Clojure, trying to use destructuring (and multimethods) where the Haskell does pattern matches.