Last in Clojure (2024)

3 hours ago 1

Well, docstring doesn’t lie :) But, you can always use (peek coll) or (first (rseq coll)) which are way faster:

=> (def x (into [] (range 1 10000)))

=> (time (last x)) “Elapsed time: 0.288122 msecs”

=> (time (peek x)) “Elapsed time: 0.026535 msecs”

=> (time (first (rseq x))) “Elapsed time: 0.040689 msecs”

Read Entire Article