Hi guys,
I am stuck and I am hoping someone can help me with this as I have
been stuck. I am working in the REPL and when I call the re-split
function
user=> (re-split #"\W+" "This is simple sentence")
I get the results properly.
However, if I try to wrap the same call within a function passing the
sentence in as a variable:
(use '[clojure.contrib.str-utils :only (re-split)])
(defn split-by-whitespace [sentence](
(re-split #"\W+" sentence)
))
(def x "This is a test")
(split-by-whitespace x)
I get the following exception:
java.lang.ClassCastException: clojure.lang.ArraySeq cannot be cast to
clojure.lang.IFn (countwords.clj:0)
Can someone provide me a clue as to what is going on here? This seems
like such a basic function that I must be missing something simple.
BTW: I am using the clojure distribution that is part of the code
examples from Stu Halloway's book.
Thanks,
John
--~--~---------~--~----~------------~-------~--~----~
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
-~----------~----~----~----~------~----~------~--~---