haskell: fix string ↔ [Char] equality — palindrome 12/12, conformance 34/34 (269/269)
Some checks failed
Test, Build, and Deploy / test-build-deploy (push) Failing after 18s
Some checks failed
Test, Build, and Deploy / test-build-deploy (push) Failing after 18s
Haskell strings are [Char]. Calling reverse / head / length on a SX raw string transparently produces a cons-list of char codes (via hk-str-head / hk-str-tail in runtime.sx), but (==) then compared the original raw string against the char-code cons-list and always returned False — so "racecar" == reverse "racecar" was False. Added hk-try-charlist-to-string and hk-normalize-for-eq in eval.sx; routed == and /= through hk-normalize-for-eq so a string compares equal to any cons-list whose elements are valid Unicode code points spelling the same characters, and "[]" ↔ "". palindrome.hs lifts from 9/12 → 12/12; conformance 33/34 → 34/34 programs, 266/269 → 269/269 tests. Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
This commit is contained in:
File diff suppressed because one or more lines are too long
@@ -1,7 +1,7 @@
|
|||||||
{
|
{
|
||||||
"date": "2026-05-07",
|
"date": "2026-05-07",
|
||||||
"total_pass": 266,
|
"total_pass": 269,
|
||||||
"total_fail": 3,
|
"total_fail": 0,
|
||||||
"programs": {
|
"programs": {
|
||||||
"fib": {"pass": 2, "fail": 0},
|
"fib": {"pass": 2, "fail": 0},
|
||||||
"sieve": {"pass": 2, "fail": 0},
|
"sieve": {"pass": 2, "fail": 0},
|
||||||
@@ -9,7 +9,7 @@
|
|||||||
"nqueens": {"pass": 2, "fail": 0},
|
"nqueens": {"pass": 2, "fail": 0},
|
||||||
"calculator": {"pass": 5, "fail": 0},
|
"calculator": {"pass": 5, "fail": 0},
|
||||||
"collatz": {"pass": 11, "fail": 0},
|
"collatz": {"pass": 11, "fail": 0},
|
||||||
"palindrome": {"pass": 9, "fail": 3},
|
"palindrome": {"pass": 12, "fail": 0},
|
||||||
"maybe": {"pass": 12, "fail": 0},
|
"maybe": {"pass": 12, "fail": 0},
|
||||||
"fizzbuzz": {"pass": 12, "fail": 0},
|
"fizzbuzz": {"pass": 12, "fail": 0},
|
||||||
"anagram": {"pass": 9, "fail": 0},
|
"anagram": {"pass": 9, "fail": 0},
|
||||||
|
|||||||
@@ -10,7 +10,7 @@ Updated 2026-05-07 · Phase 6 (prelude extras + 18 programs)
|
|||||||
| nqueens.hs | 2/2 | ✓ |
|
| nqueens.hs | 2/2 | ✓ |
|
||||||
| calculator.hs | 5/5 | ✓ |
|
| calculator.hs | 5/5 | ✓ |
|
||||||
| collatz.hs | 11/11 | ✓ |
|
| collatz.hs | 11/11 | ✓ |
|
||||||
| palindrome.hs | 9/12 | ✗ |
|
| palindrome.hs | 12/12 | ✓ |
|
||||||
| maybe.hs | 12/12 | ✓ |
|
| maybe.hs | 12/12 | ✓ |
|
||||||
| fizzbuzz.hs | 12/12 | ✓ |
|
| fizzbuzz.hs | 12/12 | ✓ |
|
||||||
| anagram.hs | 9/9 | ✓ |
|
| anagram.hs | 9/9 | ✓ |
|
||||||
@@ -38,4 +38,4 @@ Updated 2026-05-07 · Phase 6 (prelude extras + 18 programs)
|
|||||||
| config.hs | 10/10 | ✓ |
|
| config.hs | 10/10 | ✓ |
|
||||||
| counter.hs | 7/7 | ✓ |
|
| counter.hs | 7/7 | ✓ |
|
||||||
| accumulate.hs | 8/8 | ✓ |
|
| accumulate.hs | 8/8 | ✓ |
|
||||||
| **Total** | **266/269** | **33/34 programs** |
|
| **Total** | **269/269** | **34/34 programs** |
|
||||||
|
|||||||
@@ -315,6 +315,15 @@ No OCaml changes are needed. The view type is fully representable as an SX dict.
|
|||||||
|
|
||||||
_Newest first._
|
_Newest first._
|
||||||
|
|
||||||
|
**2026-05-07** — Fix string ↔ `[Char]` equality. `reverse`/`length`/`head`/etc.
|
||||||
|
on a string transparently coerce to a cons-list of char codes via `hk-str-head`
|
||||||
|
+ `hk-str-tail`, but `(==)` then compared the original raw string against the
|
||||||
|
char-code cons-list and always returned False. Added `hk-try-charlist-to-string`
|
||||||
|
+ `hk-normalize-for-eq` in `eval.sx` and routed `==` / `/=` through them, so a
|
||||||
|
string compares equal to any cons-list whose elements are valid Unicode code
|
||||||
|
points spelling the same characters (and `[]` ↔ `""`). palindrome.hs now 12/12;
|
||||||
|
conformance lifts to 34/34 programs, **269/269 tests** — full green.
|
||||||
|
|
||||||
**2026-05-07** — Phase 15 IORef complete (5 ops + module wiring + 13 unit
|
**2026-05-07** — Phase 15 IORef complete (5 ops + module wiring + 13 unit
|
||||||
tests + 2 conformance programs). `hk-bind-data-ioref!` in `eval.sx` registers
|
tests + 2 conformance programs). `hk-bind-data-ioref!` in `eval.sx` registers
|
||||||
`newIORef`, `readIORef`, `writeIORef`, `modifyIORef`, `modifyIORef'` under the
|
`newIORef`, `readIORef`, `writeIORef`, `modifyIORef`, `modifyIORef'` under the
|
||||||
|
|||||||
Reference in New Issue
Block a user