What's wrong with (map + [31 41 59 26] (iterate inc 1))  ?

(use 'clojure.contrib.seq-utils)

(defn sliding-window [coll size]
  (let [idx (into {} (indexed coll))]
    (map #(vals (select-keys idx (range (- % size) (+ % size 1))))
         (range (count coll)))))

This is the same as your second example if order isn't important.
Someone else might be able to come up with something better.  Do you
have any more/better use cases?
--~--~---------~--~----~------------~-------~--~----~
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