Add a from_char_code builtin that is the inverse of the existing char_code function.
Proposed function
from_char_code(@Nat -> @String) -- create a single-character string from an ASCII/Unicode code point
Rationale
char_code(@String, @Int -> @Nat) exists but there is no way to go from a code point back to a string. Without this, strings cannot be constructed character by character, which is needed for any algorithmic string building (encoding, formatting, character-level transformations).
Implementation notes
Trivial: allocate 1-byte string via $alloc, store the byte value, return (ptr, 1). Should validate that the value is in valid range (0-127 for ASCII, or 0-255 for extended).
Dependencies
Add a
from_char_codebuiltin that is the inverse of the existingchar_codefunction.Proposed function
from_char_code(@Nat -> @String)-- create a single-character string from an ASCII/Unicode code pointRationale
char_code(@String, @Int -> @Nat)exists but there is no way to go from a code point back to a string. Without this, strings cannot be constructed character by character, which is needed for any algorithmic string building (encoding, formatting, character-level transformations).Implementation notes
Trivial: allocate 1-byte string via
$alloc, store the byte value, return (ptr, 1). Should validate that the value is in valid range (0-127 for ASCII, or 0-255 for extended).Dependencies