Review fixes: revert partition+concat overlay, delete dead defns, dedupe de-duplicated
1. partition+concat removed from 10-seq.clj overlay — they use lazy-seq macro which produces raw make-lazy-seq forms in compile mode (same issue as mapcat overlay reversal). Must stay native. 2. Dead defns removed from core.janet: core-map-indexed, core-iterate, core-repeatedly (30 lines). Bindings already removed in prior commit. 3. dedupe removed from 40-lazy.clj — belongs in 20-coll.clj. Gates: conformance 229×3, lazy-infinite 22/22, specs 32/32.
This commit is contained in:
parent
4a2ef99fee
commit
a71bddd580
2 changed files with 18 additions and 62 deletions
|
|
@ -33,35 +33,4 @@
|
|||
fv (f fst)
|
||||
run (cons fst (take-while (fn [x] (= fv (f x))) (rest s)))]
|
||||
(cons run (step (lazy-seq (drop (count run) s)))))))))]
|
||||
(step coll)))
|
||||
|
||||
;; Lazy partition: yields complete partitions of size n. Optional step.
|
||||
;; Ported from CLJS core.cljs (no chunked-seq branches).
|
||||
(defn partition
|
||||
([n coll] (partition n n coll))
|
||||
([n step coll]
|
||||
(lazy-seq
|
||||
(when-let [s (seq coll)]
|
||||
(let [p (take n s)]
|
||||
(when (= n (count p))
|
||||
(cons p (partition n step (nthrest coll step)))))))))
|
||||
|
||||
;; Lazy concat: concatenates colls lazily. Ported from CLJS core.cljs.
|
||||
(defn concat
|
||||
([] (lazy-seq nil))
|
||||
([x] (lazy-seq x))
|
||||
([x y]
|
||||
(lazy-seq
|
||||
(let [s (seq x)]
|
||||
(if s
|
||||
(cons (first s) (concat (rest s) y))
|
||||
y))))
|
||||
([x y & zs]
|
||||
(let [step (fn step [xys zs]
|
||||
(lazy-seq
|
||||
(let [xys (seq xys)]
|
||||
(if xys
|
||||
(cons (first xys) (step (rest xys) zs))
|
||||
(when zs
|
||||
(step (first zs) (next zs)))))))]
|
||||
(step (concat x y) zs))))
|
||||
(step coll)))
|
||||
Loading…
Add table
Add a link
Reference in a new issue