Add "rangeof"

This commit is contained in:
Koichi Nakamura 2021-01-01 22:12:45 +09:00
parent 73e0b64c2c
commit 0becf86f75

16
core.fs
View file

@ -721,6 +721,22 @@ alias-builtin xor ^
compile drop compile drop
; immediate ; immediate
\ <value> a b rangeof <body> endof
\ Execute <body> when
\ a <= <value> and <value> <= b
: rangeof
compile 2
compile pick
compile >=
compile swap
compile 2
compile pick
compile <=
compile and
[compile] if
compile drop
; immediate
\ compile: ( orig1 -- orig2 ) \ compile: ( orig1 -- orig2 )
: endof : endof
[compile] else [compile] else