On 21 June 2013 11:17, Jay C <[email protected]> wrote: > Hi, I'm fairly new to Clojure and need help with a problem. The following > function always returns nil, whereas it should return the value of "line" > (which is not nil - I've tested). > >> (defn find-line-in-output [regex] >> (with-open [rdr (reader belarc-output-filepath)] >> (doseq [line (line-seq rdr)] >> (if (not (nil? (re-find (re-pattern regex) line))) >> line >> ) >> ) >> ) >> )
doseq returns nil, it's for side effecting code. If you want a return value you should use loop or something else that doesn't have side effects. Alan -- -- You received this message because you are subscribed to the Google Groups "Clojure" group. To post to this group, send email to [email protected] Note that posts from new members are moderated - please be patient with your first post. To unsubscribe from this group, send email to [email protected] 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 [email protected]. For more options, visit https://groups.google.com/groups/opt_out.
