Hi,

On Feb 16, 9:55 am, Stuart Halloway <stuart.hallo...@gmail.com> wrote:

> map is lazy, count and butlast are not lazy. Does adding a doall  
> around your call to map fix this problem?

Argh. butlast is only unlazy of degree one, so to say.

Is there a reason why not to provide a lazy version:

(defn butlast
  "Return a seq of all but the last item in coll."
  [coll]
  (lazy-seq
    (let [s (seq coll)]
      (when-let [r (next s)]
        (cons (first s) (butlast r))))))

I see, that butlast is used in the bootstraping early on. But can't
there be a bootstrap version, which does not need the whole machinery,
and a "production" butlast providing laziness? Or is it not worth the
trouble?

Sincerely
Meikel

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