On Jan 8, 2009, at 1:55 PM, Dmitri wrote:

There are two issues here that I'm seeing, first is that the list and
vector have different behavior, my understanding is that they are both
sequences and one should be able to perform the same operations on
them.

I don't know more about the underlying issue, but there's a distinction between *being* a seq and being "seq-able".

Something is a seq if it implements the ISeq interface. Lists are seqs, vectors are not seqs.

        user=> (instance? clojure.lang.ISeq '(1 2 3))
        true
        user=> (instance? clojure.lang.ISeq '[1 2 3])
        false

Something is seq-able if one can create a seq through which its contents can be viewed sequentially by calling calling "seq" on it. Lists and vectors are both seq-able.

        user=> (instance? clojure.lang.ISeq (seq '(1 2 3)))
        true
        user=> (instance? clojure.lang.ISeq (seq '[1 2 3]))
        true

The distinction is often blurred because most functions that accept a seq automatically call "seq" on the subset of their arguments that they expect to use as seqs.

You may have hit on a situation where the distinction matters.

--Steve

Attachment: smime.p7s
Description: S/MIME cryptographic signature

Reply via email to