Hi,
I think destructure should not produce nthnext, because it realize an
element of sequence more than needed.

For example:
(defn inc-seq [i]
  (iterate #(let [x (inc %)] (println "realize:" x) x) i))
;=> #'user/inc-seq

(take 1 (inc-seq 0))
;=> (0)

(take 1 (let [[x & xs] (inc-seq 0)] (cons x xs)))
; realize: 1
;=> (0)

(macroexpand '(let [[x & xs] (inc-seq 0)] (cons x xs)))
;=> (let* [vec__2630 (inc-seq 0)
              x (clojure.core/nth vec__2630 0 nil)
              xs (clojure.core/nthnext vec__2630 1)]
         (cons x xs))

Although nthrest isn't in clojure, why not to use nthrest instead of
nthnext in destructure?
What do you think?

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