moontalk/server/eventloop-server-experiment/util.4th
2024-02-17 18:26:14 +00:00

26 lines
426 B
Forth

: sconstant ( "name" str -- )
2>r : 2r> postpone sliteral postpone ; ;
: variable! ( "name" value-n -- )
create , ;
: alloterase ( n -- )
here over allot swap erase ;
: 3dup ( a b c -- a b c a b c )
>r 2dup r@ -rot r> ;
: 3drop ( a b c -- )
2drop drop ;
: to-string ( n -- str )
s>d <# #s #> ;
: startswith ( str prefix-str -- flag )
2>r over swap 2r> search IF
drop =
ELSE
3drop false
THEN ;