Re: Macro tutorials?

2011-10-10 Thread Nicolas
A good book to learn lisp macros, is On Lisp from Paul Graham. This book really cover advanced topics and concepts, and has many chapters related to macros. The book is freely available in online format from Paul Graham Website: http://www.paulgraham.com/onlisp.html On Oct 6, 1:02 pm, Michael

Re: Macro tutorials?

2011-10-10 Thread Larry Johnson
Hi, Nicolas, and thanks. I'm new to clojure (I've been working through Programming Clojure), and most of my long work life has gravitated around c, shell scripts, and perl. That being said, I've tinkered with Lisp dialects for the past twenty-five years (mostly elisp, scheme, and common lisp),

Re: Macro tutorials?

2011-10-06 Thread Stefan Kamphausen
Hi. You might consider reading Peter Seibel's excellent Practical Common Lisp which has some nice macro-work in it. If after that you're still hungry for more, consider Let Over Lambda by Doug Hoyte. Admitted, both cover Common Lisp, but the differences will not keep you from getting a

Re: Macro tutorials?

2011-10-06 Thread Michael Jaaka
Thanks to all! You have helped a lot! Also I will consider reading Practical Common Lisp. On Oct 6, 9:42 am, Stefan Kamphausen ska2...@googlemail.com wrote: Hi. You might consider reading Peter Seibel's excellent Practical Common Lisp which has some nice macro-work in it. If after that you're

Macro tutorials?

2011-10-05 Thread Michael Jaaka
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

Re: Macro tutorials?

2011-10-05 Thread Michael Jaaka
I have manage to write something like this. But nothing more, all my ideas are wrong, because bad knowledge about evaluation and namespace expansion time. (defmacro map-fnc [ methods ] `(reduce (fn[ acc# m# ] (assoc acc# (str (first m#)) (list 'fn (rest m#)) )) {} '~methods ))

Re: Macro tutorials?

2011-10-05 Thread Baishampayan Ghose
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

Re: Macro tutorials?

2011-10-05 Thread Meikel Brandmeyer (kotarak)
And just for fun some more: (defmacro map-fn [ fns] (into {} (map (fn [[n tail]] [(keyword n) `(fn ~@tail)]) fns))) -- 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

Re: Macro tutorials?

2011-10-05 Thread Baishampayan Ghose
On Wed, Oct 5, 2011 at 4:16 PM, Meikel Brandmeyer (kotarak) m...@kotka.de wrote: And just for fun some more: (defmacro map-fn   [ fns]   (into {} (map (fn [[n tail]] [(keyword n) `(fn ~@tail)]) fns))) That one looks very cool, Meikel :-) Regards, BG -- Baishampayan Ghose b.ghose at

Re: Macro tutorials?

2011-10-05 Thread Michał Marczyk
On 5 October 2011 11:38, Michael Jaaka michael.ja...@googlemail.com wrote: In fact I still don't know the macros works, I don't know when and how is evaluated and how symbols are evaluated. Macros are just functions manipulating list structure (the data structures produced by the reader when