jolt/.dirge/memory/PITFALLS.md
Yogthos fdb0f4ab83 Phase 10: Standard Library — clojure.string, clojure.set, clojure.walk
- src/jolt/clojure/string.clj (123 lines, 20 functions):
  blank?, capitalize, lower-case, upper-case, includes?, join,
  replace, replace-first, str-reverse, split, starts-with?,
  ends-with?, trim, triml, trimr, trim-newline, escape,
  index-of, last-index-of
- src/jolt/clojure/set.clj (124 lines, 10 operations):
  union, intersection, difference, select, project, rename,
  rename-keys, map-invert, join, index, subset?, superset?
- src/jolt/clojure/walk.clj (77 lines, 9 functions):
  walk, postwalk, prewalk, postwalk-demo, prewalk-demo,
  postwalk-replace, prewalk-replace, keywordize-keys,
  stringify-keys, macroexpand-all
- src/jolt/core.janet: 11 Janet string interop bindings
  (str-trim, str-upper, str-lower, str-find, str-replace,
  str-replace-all, str-reverse-b, str-join, str-split,
  str-triml, str-trimr)
- test/phase10-test.janet: 2 test sections (40-41)
  15+ assertions covering string and set functions
- All .clj files use eval-form for multi-form loading
- 315 ok, 2 fail (pre-existing, unchanged)
2026-06-03 10:12:51 -04:00

1 KiB

Janet's case for multi-arity dispatch: (defn f [& args] (case (length args) 1 ... 2 ...)). Used in core-derive, core-isa?, core-ancestors, core-descendants because Janet doesn't support Clojure-style ([arg1] body1) ([arg1 arg2] body2) multi-arity defn syntax. § Janet's boolean function doesn't exist — use (if x true false). Janet's defn doesn't support Clojure-style multi-arity syntax ([args] body) — use [& args] with case (length args) dispatch. fn? exists as Janet builtin (not Jolt core fn) — use (or (function? x) (cfunction? x)) in tests. § Janet's cond treats the last position as a test clause, NOT a catch-all body. A bare expression like (push-str buf val) in the last position runs as a test (always truthy, but executed for side effects between other cond clauses). Use true (push-str buf val) to make it a proper catch-all body. Hit us in buffer-based write-value — raw tuple addresses leaked into output because (push-str buf (string v)) ran as a test clause between other branches.