4 ms·
Here is a Factor version: : print-ing ( filepath encoding -- ) [ [ " " split [ dup "ing" tail? [ print ] [ drop ] if ] each ] each-line ]
by Avshalom 16y ago
Here is a Factor version:
: print-ing ( filepath encoding -- )
[ [
" " split
[ dup "ing" tail? [ print ] [ drop ] if ] each ]
each-line ]
with-file-reader ;
It's kind of ugly because it's designed to print out the values without leaving anything on the stack. It can be prettier if it produces an array of matching words
: collect-ing ( filepath encoding -- seq ) { } -rot
[ [
" " split
[ "ing" tail? ] filter append ]
each-line ]
with-file-reader ;
and then just prints that out
: print-ing ( filepath encoding -- )
collect-ing [ print ] each ;
- eru 16y agoThanks!