jolt's seq layer realized one element ahead of Clojure, so a side-effecting lazy seq ran its producer too eagerly. Four changes bring it in line: - rest is Clojure's more(): it returns the tail without realizing it. An unforced tail (vector / string / lazy-seq cell) comes back as a deferred seq, so (rest (iterate f x)) does not call f. next still realizes one. - iterate applies f lazily, inside the tail thunk, so (first (iterate f x)) is x with no call to f (clojure.lang.Iterate parity). - take realizes exactly n: the last element terminates without touching the rest, instead of forcing one more element of the source. - an empty realized lazy seq is still a sequence value, printing "()" not "nil" (a JVM LazySeq is never nil). Also: the map transducer's step fn now takes multiple inputs ([result input & inputs]) so a multi-collection transduce applies f across all of them. Fixes medley's join/window/sequence-padded laziness and multi-input transducer tests (now 293/293). The rest change also fixed a latent overrun in distinct/dedupe over a map's empty tail. iterate is a seed source, re-minted. |
||
|---|---|---|
| .. | ||
| image.ss | ||
| prelude.ss | ||
| README.md | ||
Chez bootstrap seed
These two files are the bootstrap compiler for jolt — the seed that makes the build self-hosting:
prelude.ss— theclojure.coreprelude (all tiers + clojure.string/walk/ template/edn/set/pprint) as Schemedef-var!forms.image.ss— the compiler image (jolt.ir+jolt.analyzer+jolt.backend-scheme) as Schemedef-var!forms.
Both are generated, not hand-written. They are checked in because a fresh
checkout must be able to build jolt-on-Chez using only Chez: host/chez/bootstrap.ss
loads this seed, then rebuilds the prelude + image from the .clj/.ss sources via
the on-Chez compiler (read → analyze → emit, all on Chez). The seed is a joint
byte-fixpoint: rebuilding from an up-to-date seed reproduces it exactly.
make selfhost (host/chez/selfcheck.sh) runs host/chez/bootstrap.ss and diffs
the rebuilt artifacts against the checked-in seed.
Re-minting
When the seed sources change (the core tiers, the compiler namespaces, the host
contract, the reader, emit-image.ss), the seed drifts and make selfhost
fails. Re-mint it by running host/chez/bootstrap.ss and writing the freshly
rebuilt prelude/image back to host/chez/seed/prelude.ss /
host/chez/seed/image.ss, then commit the refreshed files.