HS: append command, list stringify as comma-separated

Compiler:
- append to symbol → (set! target (hs-append target value))
- append to DOM → (hs-append! value target)

Runtime:
- hs-append: pure function for string concat and list append
- hs-append!: DOM insertAdjacentHTML for element targets

Mock DOM:
- dom_stringify handles List by joining elements with commas
  (matching JS Array.toString() behavior)

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
This commit is contained in:
2026-04-20 19:40:27 +00:00
parent c25ab23709
commit c8aab54d52
3 changed files with 40 additions and 23 deletions

View File

@@ -1644,13 +1644,14 @@ let run_spec_tests env test_files =
| _ -> Nil);
(* Stringify a value for DOM string properties *)
let dom_stringify = function
let rec dom_stringify = function
| String s -> String s
| Number n ->
let i = int_of_float n in
if float_of_int i = n then String (string_of_int i) else String (string_of_float n)
| Bool true -> String "true"
| Bool false -> String "false"
| List l -> String (String.concat "," (List.map (fun v -> match dom_stringify v with String s -> s | _ -> "") l))
| Nil -> String ""
| v -> String (Sx_types.inspect v)
in