When an int is on the stack, chr replaces it with the appropriate single-ascii-char string (if it's a printable character; empty otherwise), as expected.
When a single-char ASCII string is on the stack, chr (which from the docs I'm assuming is polymorphic) gives an error, instead of leaving the corresponding int value for the character on the stack.
λ "h" chr
(!) <repl>(1,7) [chr]: Symbol: chr - Incorrect values found on the stack:
- expected: int chr
- got: string chr
<repl>(1,7) in symbol: chr
The new getchr and putchr from #59 work perfectly btw, thank you :))
Ooops... no, chr isn't polymorphic... to get the ASCII code of a character you have to use ord (I basically exposed Nim's chr and ord methods)... that was a typo in the docs 😜 -- fixed now.
When an
int
is on the stack,chr
replaces it with the appropriate single-ascii-char string (if it's a printable character; empty otherwise), as expected.When a single-char ASCII string is on the stack,
chr
(which from the docs I'm assuming is polymorphic) gives an error, instead of leaving the corresponding int value for the character on the stack.The new
getchr
andputchr
from #59 work perfectly btw, thank you :))