nth claims to also work on regex Matchers:

user=> (doc nth)
-------------------------
clojure.core/nth
([coll index] [coll index not-found])
  Returns the value at the index. get returns nil if index out of
  bounds, nth throws an exception unless not-found is supplied.  nth
  also works for strings, Java arrays, regex Matchers and Lists, and,
  in O(n) time, for sequences.

Please, could somebody show me an example of that? I tried things
along the lines of:

user=> (re-seq #"a" "ababaa")
("a" "a" "a" "a")
user=> (re-matcher #"a" "ababaa")
#<Matcher java.util.regex.Matcher[pattern=a region=0,6 lastmatch=]>
user=> (nth (re-matcher #"a" "ababaa") 0)
java.lang.IllegalStateException: No match found (NO_SOURCE_FILE:0)
user=> (seq (re-matcher #"a" "ababaa"))
java.lang.IllegalArgumentException: Don't know how to create ISeq
from: Matcher (NO_SOURCE_FILE:0)

... but no success so far.

Thank you, Frantisek
--~--~---------~--~----~------------~-------~--~----~
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
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