Hi!

I wrote few apps with clojure. I have used many times macro to expand
expressions and change some control flows. I thought that I know
macros, but now I know that doing some programming by analogy is not
enough. In fact I still don't know the macros works, I don't know when
and how is evaluated and how symbols are evaluated. Problem below is
something which I'm not able to solve with my current "knowledge".

Let say that I wrote macro map-fnc

and I want to use it like

(map-fnc (function1 [] "hello")
        (function2 [a] (println a)) )

The result is map in which keys are names of methods as strings and
body is a function with proper arity.
So I can evalutate this:


((get (map-fnc (function1 [] "hello")
                (function2 [a] (println a)) ) "function1"))

or this


((get (map-fnc (function1 [] "hello")
                (function2 [a] (println a)) ) "function2") "hello world")

Any help?! I belive that solving this problem might give me more
insight on how macro works.

Thanks in advance!

-- 
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