On Oct 2, 2:46 pm, Fogus <[EMAIL PROTECTED]> wrote:
> OK.  So we can do:
> (map (fn [x] x) "abc")
> (first "abc")
> (rest "abc")
> (filter (fn [x] (if (= x \b) false true)) "abc")
> (seq "abc")
> etc...
>
> So why is (seq? "abc") false?
>

Because a string is not a seq. first/rest/map/filter etc all call seq
on their collection arguments.

user=> (seq? (seq "abc"))
true

Basically, all collections, and several other things, are seq-able.
But that doesn't make them seqs. Calling seq on most things returns a
different object which provides a sequential view:

user=> (identical? "abc" (seq "abc"))
false
user=> (= "abc" (seq "abc"))
false

seq? tests whether something is an actual implementation of ISeq, not
whether it supports having seq called on it.

Hope that helps,

Rich

--~--~---------~--~----~------------~-------~--~----~
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 [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/clojure?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to