RosettaCodeData/Task/Odd-word-problem/Forth/odd-word-problem.fth
2023-07-01 13:44:08 -04:00

6 lines
301 B
Forth

: word? dup [char] . <> over bl <> and ;
: ?quit dup [char] . = if emit quit then ;
: eatbl begin dup bl = while drop key repeat ?quit ;
: even begin word? while emit key repeat ;
: odd word? if key recurse swap emit then ;
: main cr key eatbl begin even eatbl space odd eatbl space again ;