summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorRich Hickey <richhickey@gmail.com>2008-07-03 13:11:59 +0000
committerRich Hickey <richhickey@gmail.com>2008-07-03 13:11:59 +0000
commitc55ab92feb7042b2bd98d3ce8995d74f9646a594 (patch)
treed151a1e94a9710ff5e3ff1cc4e47f052dafeab67
parent1a7c8810b0c37f432a7c55ae51e64186c08bd30e (diff)
added drop-last
-rw-r--r--src/boot.clj5
1 files changed, 5 insertions, 0 deletions
diff --git a/src/boot.clj b/src/boot.clj
index bcf85744..832c494d 100644
--- a/src/boot.clj
+++ b/src/boot.clj
@@ -1158,6 +1158,11 @@ not-every? (comp not every?))
(recur (dec n) (rest coll))
coll))
+(defn drop-last
+ "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))))
+
(defn drop-while
"Returns a lazy seq of the items in coll starting from the first
item for which (pred item) returns nil."