On Nov 24, 2013, at 10:19 , David Simmons <shortlypor...@gmail.com> wrote:
> I wish to process each item in a vector. I know I can use map to do this e.g. > (map my-func my-vector). My problem is that I need to be able to break out of > the map if my-func returns an error when processing any of the items. I know > map isn't what I'm looking for but is there a function or some idiomatic > piece of clojure to achieve my aim. If you only want to break when there's an error, you could use exceptions. Alternatively, if my-func ordinarily doesn't return nil, you could take advantage of map's laziness by having my-func return nil on failure-- then you just stop consuming the output of map when you hit a nil value. -- -- 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 --- You received this message because you are subscribed to the Google Groups "Clojure" group. To unsubscribe from this group and stop receiving emails from it, send an email to clojure+unsubscr...@googlegroups.com. For more options, visit https://groups.google.com/groups/opt_out.