applyto force evaluation of the arguments seq but it's not the case when the applied function is variadic.
but-lastto avoid name clash with
butlastwhich is a low-level function (it is used in the definition of
"Return a lazy sequence of all but the n last items in coll."
([coll] (but-last coll 1))
((fn this [s os]
(lazy-cons (first s) (this (rest s) (rest os))))) (seq coll) (drop n coll))))
(defn drop-lastand shared with us, mere mortals, a piece of wisdom:
"Return a lazy seq of all but the last n (default 1) items in coll"
([s] (drop-last 1 s))
([n s] (map (fn [x _] x) (seq s) (drop n s))))
I constantly have to remind myself to try to use a higher-order fn, because lazy-cons is so easyFrom now on, I'll try to question each lazy-cons.