I do the following (with range-length 1e8):
    (time (let [[t d] (split-with #(< % 12) (range range-length))]
               [(count d) (count t)]))

    (time (let [[t d] (split-with #(< % 12) (range range-length))]
               (into [] (reverse [(count t) (count d)]))))

​This gives:
    "Elapsed time: 68105.338314 msecs"
    [99999988 12]
    "Elapsed time: 11545.667394 msecs"
    [99999988 12]

So the first expression​
​ takes as six times as long to evaluate. ​
​I understood that this has to do with that in the first case there is head
retention. But I do not understand this. What is happening here?​


-- 
Cecil Westerhof

-- 
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
--- 
You received this message because you are subscribed to the Google Groups 
"Clojure" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to clojure+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to