ocaml: character type — Char of int, #\a parser, all char primitives
- Char of int variant in sx_types.ml (Unicode codepoint) - type_of → "char", inspect → #\a / #\space / #\newline notation - #\ char literal reader in sx_parser.ml (named + single-char) - make-char char? char->integer integer->char char-upcase char-downcase - char=? char<? char>? char<=? char>=? comparators - char-ci=? char-ci<? char-ci>? char-ci<=? char-ci>=? case-insensitive - char-alphabetic? char-numeric? char-whitespace? char-upper-case? char-lower-case? - string->list (returns Char values) and list->string (accepts Char values) - fix get_val in sx_runtime.ml: add Integer n case for list indexing - fix raw_serialize in sx_server.ml: Integer and Char variants - 4493/4493 tests — +43 passing, zero regressions Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
This commit is contained in:
@@ -211,6 +211,8 @@ let get_val container key =
|
||||
| Dict d, Keyword k -> dict_get d k
|
||||
| (List l | ListRef { contents = l }), Number n ->
|
||||
(try List.nth l (int_of_float n) with _ -> Nil)
|
||||
| (List l | ListRef { contents = l }), Integer n ->
|
||||
(try List.nth l n with _ -> Nil)
|
||||
| Nil, _ -> Nil (* nil.anything → nil *)
|
||||
| _, _ -> Nil (* type mismatch → nil (matches JS/Python behavior) *)
|
||||
|
||||
|
||||
Reference in New Issue
Block a user