On Tuesday, June 16, 2015 at 7:40:24 AM UTC-4, Jeroen van Dijk wrote: > > Ah thanks James, I missed the pending nil. The actual value is still nil > indeed: > > user=> (def m (re-matches #".*(foo\.gif).*" "foo.gif\n")) > "foo.gif\n"#'user/m > user=> m > nil > > Not sure what would be the cause here then, but the random printing of the > second argument of re-matches also happens when I evaluate an arbitrary > function after the exception > > PatternSyntaxException Unmatched closing ')' near index 13 > .*(foo\.gif).*) > ^ java.util.regex.Pattern.error (Pattern.java:1924) > RuntimeException Unmatched delimiter: ) > clojure.lang.Util.runtimeException (Util.java:221) > user=> (list 1 2) > "foo.gif\n"(1 2) > > cider doesn't have this problem either it seems >
Looks like something in re-matches is printing the second argument, but without a terminating newline. A subsequent print, such as of "nil\n" or "(1 2)\n", by the REPL evaluator, with a newline, then completes the line and flushes the output buffer. There seem to be three separate errors here, two of them in re-matches: 1. The one case where you slipped in an extra close parenthesis, which is what caused the exceptions. 2. The peculiar printing (without flushing) of the second argument by re-matches. (I don't know where it's going with some of the different REPLs but perhaps those ones maintain a different output stream for *out* and for REPL evaluation result printing.) 3. The regexp *should* match "foo.gif\n" from the looks of it, but seems not to be doing so. -- 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/d/optout.