Now that you said it, it all makes perfect sense. I'm in the process of switching from Scheme to Clojure and these are some "bad" habits. This case makes me also realise that dealing with lazy sequences can be a delicate matter in cases where you want eager evaluation, since you really have to call doseq/dorun explicitly to get the elements of the sequence evaluated instead of merely evaluating the sequence- generating expression. In the case I was originally considering, I had a sequence of invocations of a test function that would return a lazy sequence of calls to another testing function. As a result, each of such invocations would work when evaluated in REPL but after grouping a number of them in "test case" no tests were being performed...
Lesson learned, thanks Tim! Marcin On Feb 2, 5:56 pm, Timothy Baldridge <tbaldri...@gmail.com> wrote: > Map actually doesn't do anything at all. It simply creates a new lazy > sequence. Instead of map, use doseq and you'll get the result you > expect. Since you actually never print the result of the map, the lazy > sequence is just thrown away, and f is never called, hence never > evaluates. > > Timothy > > > > > > > > > For example, the following program when evaluated (I'm > > running Clojure 1.3) returns "wrong". > > > (let [f (fn [x] (if (= x 10) > > (throw (new RuntimeException "error!")) > > "right"))] > > (map f (list 10)) > > "wrong") -- 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