fix example/NumbersWithoutPrefix.forth for single digits (thanks to kiyoshi for noticing this)
FossilOrigin-Name: aca9b86d89658976a7939525039b687226dc2f93ff4455a9fa4b1b0263ab85d7
This commit is contained in:
parent
20ff1927ea
commit
d2b70f5865
1 changed files with 16 additions and 0 deletions
|
@ -27,6 +27,22 @@ the handler) and pass it to `s:to-number` and `class:data`.
|
|||
}}
|
||||
~~~
|
||||
|
||||
For single digits, define each digit as a word. (Prefixes
|
||||
are not processed for tokens with nothing other than the
|
||||
prefix character, so this takes care of the issue).
|
||||
|
||||
~~~
|
||||
:1 (-n) #1 ;
|
||||
:2 (-n) #2 ;
|
||||
:3 (-n) #3 ;
|
||||
:4 (-n) #4 ;
|
||||
:5 (-n) #5 ;
|
||||
:6 (-n) #6 ;
|
||||
:7 (-n) #7 ;
|
||||
:8 (-n) #8 ;
|
||||
:9 (-n) #9 ;
|
||||
~~~
|
||||
|
||||
Handling negative numbers is a bigger headache though. By
|
||||
convention, RETRO uses - to imply "not" (as in `-eq?`). So
|
||||
to handle the `-` prefix for numbers, it needs to fall back
|
||||
|
|
Loading…
Reference in a new issue