Hi,

Am 11.12.2010 um 23:10 schrieb Alexander Yakushev:

> Thanks for your response! Your example is very useful, though I wanted
> to implement the multimethods without that multi-call layer, so it
> will look just like an ordinary function. Thanks to Ken Wesson I
> already have an idea how to do this.

I'm a bit confused. It just looks like a normal function call.

(my-defmulti foo type)

(my-defmethod foo String [x] (str "A String: " x))

(foo "Hello, World!")

So it just looks like an ordinary function. Extracting the multi-call function 
saves code size, eases macro development and allows to change the underlying 
driver function for all multimethods while working on it. Very helpful, because 
you don't have to re-call the my-defmulti macro, but still have the changes 
take immediate effect.

> Oh, that's my fault, I tried with-meta function on the atom and it
> wouldn't work. Still, after I defined an atom with some metadata in
> it, how can I change it thereafter?

I believe, you can't. You have to create a new atom.

Sincerely
Meikel

-- 
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
Note that posts from new members are moderated - please be patient with your 
first post.
To unsubscribe from this group, send email to
clojure+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/clojure?hl=en

Reply via email to