Re: pattern matching in function parameters

2008-11-22 Thread André Thieme
On 19 Nov., 22:16, "Mark Volkmann" <[EMAIL PROTECTED]> wrote: > I'm reading an excellent article on functional programming > athttp://www.defmacro.org/ramblings/fp.html. Toward the end there is a > section on pattern matching. They give the following example which > uses a fictional, Java-like sy

Re: pattern matching in function parameters

2008-11-19 Thread J. McConnell
On Wed, Nov 19, 2008 at 4:16 PM, Mark Volkmann <[EMAIL PROTECTED]> wrote: > > I'm reading an excellent article on functional programming at > http://www.defmacro.org/ramblings/fp.html. Toward the end there is a > section on pattern matching. They give the following example which > uses a fictional

Re: pattern matching in function parameters

2008-11-19 Thread Kevin Downey
(defmulti fib (fn [x] x) :default) (defmethod fib 0 [x] 0) (defmethod fib 1 [x] 1) (defmethod fib :default [n] (+ (fib (- n 2)) (fib (- n 1 seems to do the trick. On Wed, Nov 19, 2008 at 1:25 PM, Kyle R. Burton <[EMAIL PROTECTED]> wrote: > > I have no idea how much effort it would be, but I'

Re: pattern matching in function parameters

2008-11-19 Thread Kyle R. Burton
I have no idea how much effort it would be, but I've found the common lisp pcond library to be useful for pattern matching and a few other use cases: http://www.cliki.net/pcond I'd also like to see support for value based as well as structural shape based pattern matching. Regards, Kyle On

pattern matching in function parameters

2008-11-19 Thread Mark Volkmann
I'm reading an excellent article on functional programming at http://www.defmacro.org/ramblings/fp.html. Toward the end there is a section on pattern matching. They give the following example which uses a fictional, Java-like syntax. Can Clojure do something like this where the fib function is ove