Step 5 re-fix: dedupe make-lazy-seq after stash restore
The git stash pop restored the old lazy-seq version of dedupe. Re-applied the make-lazy-seq + coll->cells fix for the 20-coll tier where lazy-seq macro is not yet available.
This commit is contained in:
parent
2680b1e848
commit
9a82411e34
3 changed files with 198 additions and 41 deletions
|
|
@ -209,11 +209,25 @@
|
|||
(defn rationalize [x] x)
|
||||
|
||||
;; trampoline: repeatedly calls f with args until a non-function result.
|
||||
(defn trampoline
|
||||
([f]
|
||||
(let [ret (f)]
|
||||
(if (ifn? ret)
|
||||
(recur ret)
|
||||
ret)))
|
||||
([f & args]
|
||||
(let [ret (apply f args)]
|
||||
(if (ifn? ret)
|
||||
(recur ret)
|
||||
ret))))
|
||||
|
||||
;; rand-int: random integer in [0, n). Uses Janet math/random.
|
||||
# rand-int stays native in core.janet (Janet math/floor + math/random)
|
||||
|
||||
;; Eager dedupe of consecutive equal elements (Jolt has no transducer arity yet).
|
||||
(defn dedupe [coll]
|
||||
(defn dedupe
|
||||
"Returns a lazy seq removing consecutive duplicates in coll."
|
||||
[coll]
|
||||
(let [step (fn step [s prev]
|
||||
(make-lazy-seq
|
||||
(fn* []
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue