Re: Newbie: Adding metadata to a method

2008-11-23 Thread Michael Wood
On Sun, Nov 23, 2008 at 5:39 PM, samppi <[EMAIL PROTECTED]> wrote: > > The answer to your question at the end, by the way, is that you're not > var-quoting the x. 'defn attaches metadata to the variable object you > define, not the function object itself. (meta x) is the metadata of > the _value_

Re: Newbie: Adding metadata to a method

2008-11-23 Thread samppi
The answer to your question at the end, by the way, is that you're not var-quoting the x. 'defn attaches metadata to the variable object you define, not the function object itself. (meta x) is the metadata of the _value_ of x, which is just the function with no metadata. To get the variable's meta

Re: Newbie: Adding metadata to a method

2008-11-22 Thread Michael Wood
Hi On Sat, Nov 22, 2008 at 7:32 AM, samppi <[EMAIL PROTECTED]> wrote: > > I'm trying to unit-test a mutli-function's methods without resorting > to a separate test file. I can do this: > > (defn foo >([x] (+ x 2)) >{:test (fn [] (= (foo 3) 4))}) > > ...but how do I do something like this

Newbie: Adding metadata to a method

2008-11-21 Thread samppi
I'm trying to unit-test a mutli-function's methods without resorting to a separate test file. I can do this: (defn foo ([x] (+ x 2)) {:test (fn [] (= (foo 3) 4))}) ...but how do I do something like this? ; Does not work (defmethod foo :mapping ([x] (assoc x :a 5)) {:test (