loop

37 views
Skip to first unread message

George Tasso

unread,
Dec 29, 2014, 5:48:52 AM12/29/14
to comp...@googlegroups.com
I am new to clojure , i just simply wanted to loop through a list and
have them printed out

I wonder why when i do this i get no result

(doseq [x [ 1 2 3 4]
(prn x))

regards,

George

Colin Jones

unread,
Dec 29, 2014, 11:29:43 AM12/29/14
to comp...@googlegroups.com
It's because you are missing an ending square bracket on the first line. It should be 

(doseq [x [1 2 3 4]]
  (prn x))

This mailing list is specific to Compojure, the web routing library. The main Clojure mailing list is probably a better place to ask general clojure questions like this one: https://groups.google.com/forum/#!forum/clojure

Jeff Bowman

unread,
Dec 29, 2014, 11:46:28 AM12/29/14
to comp...@googlegroups.com
Works in the repl (ie lein repl, then your code), but prn doesn't return a value and doseq returns nil

(see: http://clojure.github.io/clojure/clojure.core-api.html#clojure.core/prn http://clojure.github.io/clojure/clojure.core-api.html#clojure.core/doseq)




On Monday, December 29, 2014 4:48:52 AM UTC-6, gtasso wrote:
Reply all
Reply to author
Forward
0 new messages