2008/12/22 Brian Doyle <brianpdo...@gmail.com>: > > 2008/12/22 J. McConnell <jdo...@gmail.com> >> >> 1:1 user=> (defn multiplication-row [n k] >> (map (partial * k) (range 1 (inc n)))) >> #'user/multiplication-row >> 1:3 user=> (defn multiplication-table [n] >> (map (partial multiplication-row n) (range 1 (inc n)))) >> #'user/multiplication-table >> 1:5 user=> (defn pretty-print-row [row] >> (doseq [v row] (print v \space)) (print \newline)) >> #'user/pretty-print-row >> 1:7 user=> (defn print-multiplication-table [n] >> (doseq [row (multiplication-table n)] (pretty-print-row row))) >> #'user/print-multiplication-table > > This is off topic from the original questions, but are the 1:#'s in your > REPL line numbers?
Yup! I am using Stephen Gilardi's repl_ln from clojure-contrib. You can find the original announcement of it here: http://groups.google.com/group/clojure/browse_thread/thread/d1b5dfdb7c330f6/a1c3d36c0e157528?lnk=gst&q=repl_ln#a1c3d36c0e157528 > If so, what did you do to get those? Also if those are line numbers how > come only odd > numbers are printed? What does the '1:' stand for? Thanks. Line 1:2 was "(map (partial * k) (range 1 (inc n))))", line 1:4 was "(map (partial multiplication-row n) (range 1 (inc n))))", etc. I.e. line numbers aren't printed when a line is a continuation of the expression from the line above it. It just so happened that in these examples, I was using two lines per expression, so all of the even-numbered were skipped. The "1:" stands for the nesting level, so if I started a new REPL from within this one, it would have changed to "2:". Check out repl_ln.clj if you are interested: http://code.google.com/p/clojure-contrib/source/browse/trunk/src/clojure/contrib/repl_ln.clj - J. --~--~---------~--~----~------------~-------~--~----~ 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 -~----------~----~----~----~------~----~------~--~---