Initial data commit

This commit is contained in:
Ingy döt Net 2023-07-01 11:58:00 -04:00
parent 72d218235f
commit f23f22d71c
199087 changed files with 3378941 additions and 0 deletions

View file

@ -0,0 +1,2 @@
( condition ) IF ( true statements ) THEN
( condition ) IF ( true statements ) ELSE ( false statements ) THEN

View file

@ -0,0 +1 @@
10 < IF ." Less than 10" ELSE ." Greater than or equal to 10" THEN

View file

@ -0,0 +1,5 @@
( n -- ) CASE
( integer ) OF ( statements ) ENDOF
( integer ) OF ( statements ) ENDOF
( default instructions )
ENDCASE

View file

@ -0,0 +1,6 @@
: test-case ( n -- )
CASE
0 OF ." Zero!" ENDOF
1 OF ." One!" ENDOF
." Some other number!"
ENDCASE ;

View file

@ -0,0 +1,19 @@
: switch
CREATE ( default-xt [count-xts] count -- ) DUP , 0 DO , LOOP ,
DOES> ( u -- ) TUCK @ MIN 1+ CELLS + @ EXECUTE ;
:NONAME ." Out of range!" ;
:NONAME ." nine" ;
:NONAME ." eight" ;
:NONAME ." seven" ;
:NONAME ." six" ;
:NONAME ." five" ;
:NONAME ." four" ;
:NONAME ." three" ;
:NONAME ." two" ;
:NONAME ." one" ;
:NONAME ." zero" ;
10 switch digit
8 digit \ eight
34 digit \ Out of range!

View file

@ -0,0 +1,15 @@
: CASE: ( <name>) CREATE ;
\ lookup execution token and compile
: | ( <name> ) ' compile, ;
: ;CASE ( n -- ) DOES> OVER + + @ EXECUTE ;
: FOO ." FOO" ;
: BAR ." BAR" ;
: FIZZ ." FIZZ" ;
: BUZZ ." BUZZ" ;
CASE: SELECT ( n -- ) | FOO | BAR | FIZZ | BUZZ ;CASE
\ Usage: 3 SELECT