On Feb 2, 3:02 pm, Wardrop <t...@tomwardrop.com> wrote:
> 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?

Just a guess, but perhaps none of your tests pass:

user=> (cond false :foo)
nil



> 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.

The :>> keyword used by condp is sort of what you want, except the
test mechanism of condp isn't (there has been talk of adding :>> to
cond).  For now I'd say the simplest thing is nested if-lets.  On a
related note, if the regex-related function returns nil when there's
no match then you can use that as the test, rather than bothering with
(complement nil?).

-- 
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

Reply via email to