You can combine 'drop and 'drop-last to get a seq version of subvec (but 
> lazy and O(n)). As for the issue of concrete types: in general, clojure's 
> sequence functions return seqs, not instances of whatever concrete type you 
> gave them.  If you need a specific type, you normally just pour the result 
> through 'into or one of the specific collection creation functions.


Do you mean something like this:

(defn subseqx [s start end] (into (empty s) (drop-last (- (count s) end) 
(drop start s))))

Two things I don't like it:

1. It does not work
(subseqx [1 2 3] 1 3) => [2 3]
(subseqx '(1 2 3) 1 3) => (3 2)
because "into" will reverse the order on sequence.

2. kind of ugly for such a simple thing, and may not be efficient either.

Any SIMPLE way to do it? I need concrete type unchanged. I don't think that 
is a rare need/use case.

PS: when I say "sequences", how should I distinguish between general 
sequence and concrete sequences? Any conventions for the wording?
  

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