RosettaCodeData/Task/Tokenize-a-string/Retro/tokenize-a-string-1.retro

14 lines
332 B
Plaintext

{{
: char ( -$ ) " " ;
: tokenize ( $-$$ )
@char ^strings'splitAtChar withLength 1- over + 0 swap ! tempString ;
: action ( $- )
keepString ^buffer'add ;
---reveal---
: split ( $cb- )
^buffer'set !char
char ^strings'append
[ tokenize action dup 1 <> ] while drop
^buffer'get drop ;
}}