Step 4: evaluator eager assumptions — lazy rest + lazy mapcat
Fix & rest destructuring (evaluator.janet): when the original value is a lazy-seq, derive & rest by walking ls-rest vi steps instead of slicing the eagerly-realized array from d-realize. Rewrite core-mapcat as a lazy state machine (core.janet): step through input colls one element at a time, call f on each tuple, then yield from f's result collection. No apply-forcing — all input colls are walked lazily via lazy-from + seq-done?. Add mapcat to core-renames (compiler.janet) and remove from Clojure overlay (10-seq.clj) — compile mode now emits direct calls to the lazy core-mapcat, fixing the pre-existing protocol-on-record compile error. Tests: re-enabled mapcat infinite harness case, added 2 & rest laziness cases. 21/21 lazy-infinite, 229x3 conformance, 32/32 specs.
This commit is contained in:
parent
ff8ffb8cd6
commit
42da5cef9a
5 changed files with 60 additions and 26 deletions
|
|
@ -22,8 +22,3 @@
|
|||
(if (next s)
|
||||
(recur (conj ret (first s)) (next s))
|
||||
(seq ret))))
|
||||
|
||||
(defn mapcat
|
||||
([f] (comp (map f) cat))
|
||||
([f & colls]
|
||||
(apply concat (apply map f colls))))
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue