RosettaCodeData/Task/Strip-comments-from-a-string/Oforth/strip-comments-from-a-string.fth

5 lines
165 B
Forth
Raw Permalink Normal View History

2023-07-01 11:58:00 -04:00
: stripComments(s, markers)
| firstMarker |
markers map(#[ s indexOf ]) reduce(#min) ->firstMarker
s firstMarker ifNotNull: [ left(firstMarker 1 - ) ] strip ;