Hello,
Being new to Clojure, to Lisp and to functional programming in general, I have some trouble wraping my head around it. As the first exercice, I would like to print multiplication table of specified order, like: (print-multiplication-table 3) 1 2 3 2 4 6 3 6 9 I came that far: (defn multiplication-row [n k] (map (partial * k) (range 1 (inc n)))) (defn multiplication-table [n] (map (partial multiplication-row n) (range 1 (inc n)))) (println (multiplication-table 3)) ; => ((1 2 3) (2 4 6) (3 6 9)) Now, how to pretty print this? This does not work - prints nothing - why?: (defn pretty-print-row [row] (map print row)) This also does not work - throws java.lang.UnsupportedOperationException: Can only recur from tail position (hello_world.clj:47) - why?: (defn pretty-print-row [row] (if (first row) ((print (first row)) (recur (rest row))))) Once I remove print expression, exception is not thrown (what the heck?) Regards, Piotrek --~--~---------~--~----~------------~-------~--~----~ 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 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 -~----------~----~----~----~------~----~------~--~---