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)
This commit is contained in:
parent
e63c2ce8d5
commit
fdb0f4ab83
10 changed files with 518 additions and 77 deletions
|
|
@ -43,3 +43,26 @@ Both tables must be updated together when adding core fns. Missing entries = sil
|
|||
## `set!` Field Mutation Reader Quirk
|
||||
|
||||
`(set! (.-x obj) val)` parses as array with `.-x` symbol head — not as standalone `.-x` symbol. Check for this case before the `(. obj -field)` shorthand.
|
||||
|
||||
## Janet `cond` Requires `true` Guard for Catch-All
|
||||
|
||||
A bare expression in the last position of `cond` is treated as a **test** clause (not body). Use `true` as the test:
|
||||
|
||||
```janet
|
||||
(cond (nil? x) (buf "nil") (number? x) (buf (string x)) true (buf (string x)))
|
||||
```
|
||||
|
||||
Without `true`, the last expression executes as a side-effect test between branches. Hit us in buffer-based write-value — raw tuple addresses leaked into REPL output.
|
||||
|
||||
## Janet `cond` Requires `true` Guard for Catch-All
|
||||
|
||||
A bare expression in the last position of `cond` is treated as a **test** clause (not body). It executes between other branches as a side-effect test. Use `true` as the test to make it a proper catch-all:
|
||||
|
||||
```janet
|
||||
(cond
|
||||
(nil? x) (buf "nil")
|
||||
(number? x) (buf (string x))
|
||||
true (buf (string x))) ; ← `true` required
|
||||
```
|
||||
|
||||
Without `true`, `(push-str buf (string v))` in the last position leaked raw tuple addresses into REPL output.
|
||||
Loading…
Add table
Add a link
Reference in a new issue