I've noticed that the output of a script, is often different to the output of the same commands if run on the REPL. This makes sense, but here's a situation which has got me a little confused. I'm trying to run this code as a script...
(use '[clojure.contrib.duck-streams]) (for [line (line-seq (reader "C:\\filedupes.txt"))] (cond ((complement nil?) (re-matches #"([0-9]+) byte\(null\)each:" line)) (println "Byte pattern!") ((complement nil?) (re-matches #".*(\.[0-9a-zA-Z]+)" line)) (println "File pattern!") ) ) (println "Finished!") The problem is, the only output I get is "Finished!". If however, I run this on the command line, I get a long list of nil's in amongst the strings "Byte pattern!" and "File pattern!". I expect the nil's not to show when this is run as a script, but why are the aforementioned strings not being output? While you're at it, you may be able to help me with an additional problem I'm trying to tackle. As you can see if the above code, I'm trying to match on certain lines of a text file. I'm using "cond" to do this with as a switch statement is the only way I know how to achieve what I'm after. Anyway, I not only want the regex to be used in the condition expression, but also want to capture the first sub- match (i.e. what's in the parenthesis inside the regex). What's the best way I can do this, without having to re-run the regex twice. Thanks -- 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