moontalk/server/eventloop-server-experiment/util.4th

26 lines
426 B
Plaintext
Raw Normal View History

2024-02-17 13:26:14 -05:00
: 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 ;