nandi/clonimpublic Fork
⑂ af5c846
Commits
⬇ Clone ▾
git clone https://git.rickub.com/nandi/clonim.git
git clone ssh://git@rickub.com/nandi/clonim.git

Host key fingerprint (ed25519): SHA256:iycHnxEyq0Q7uyVpB7JlznP0G7JrTPXLYRcAU5CSLhc — verify it before your first connect.

Download ZIP

fix: a string seqs as characters, not one-character strings

(map int "IHDR") is how a PNG encoder writes a chunk type; it needs chars.

Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
nandithebull committed 2026-09-21T01:26:47-07:00 Browse files
af5c846 parent: 59d1739
modified examples/hostfns.clj +3 -0
@@ -29,3 +29,6 @@
2929 (let [v (volatile! 1)] (vreset! v 9) (println @v (vswap! v + 1))) ; 9 10
3030 (println (boolean nil) (instance? (class (int-array 0)) (int-array 2)))
3131 (println (try (throw (ex-info "boom" {})) (catch Exception e (ex-message e))))
32+
33+;; a string is a sequence of characters
34+(println (map int "IHDR") (first "xy") (apply str (reverse "abc")))
@@ -29,3 +29,6 @@
29 (let [v (volatile! 1)] (vreset! v 9) (println @v (vswap! v + 1))) ; 9 1029 (let [v (volatile! 1)] (vreset! v 9) (println @v (vswap! v + 1))) ; 9 10
30 (println (boolean nil) (instance? (class (int-array 0)) (int-array 2)))30 (println (boolean nil) (instance? (class (int-array 0)) (int-array 2)))
31 (println (try (throw (ex-info "boom" {})) (catch Exception e (ex-message e))))31 (println (try (throw (ex-info "boom" {})) (catch Exception e (ex-message e))))
32+
33+;; a string is a sequence of characters
34+(println (map int "IHDR") (first "xy") (apply str (reverse "abc")))
modified src/runtime.nim +1 -1
@@ -689,7 +689,7 @@ proc toSeq*(v: Value): seq[Value] =
689689 of kList, kVector, kSet, kCons, kChunk, kLazy: v.items
690690 of kStr:
691691 var r: seq[Value] = @[]
692- for c in v.s: r.add mkStr($c)
692+ for c in v.s: r.add mkChar(int64(ord(c)))
693693 r
694694 of kMap:
695695 var r: seq[Value] = @[]
@@ -689,7 +689,7 @@ proc toSeq*(v: Value): seq[Value] =
689 of kList, kVector, kSet, kCons, kChunk, kLazy: v.items689 of kList, kVector, kSet, kCons, kChunk, kLazy: v.items
690 of kStr:690 of kStr:
691 var r: seq[Value] = @[]691 var r: seq[Value] = @[]
692- for c in v.s: r.add mkStr($c)692+ for c in v.s: r.add mkChar(int64(ord(c)))
693 r693 r
694 of kMap:694 of kMap:
695 var r: seq[Value] = @[]695 var r: seq[Value] = @[]
modified tests/hostfns.expected +1 -0
@@ -14,3 +14,4 @@ true true true true 2
1414 9 10
1515 false true
1616 boom
17+(73 72 68 82) x cba
@@ -14,3 +14,4 @@ true true true true 2
14 9 1014 9 10
15 false true15 false true
16 boom16 boom
17+(73 72 68 82) x cba