3 ms·
Perhaps more idiomatic: import Data.List main = putStr . unlines . filter ("ing" `isSuffixOf`) . words =<< getContents (To be read from right to left.) A
by eru 16y ago
Perhaps more idiomatic:
import Data.List
main = putStr . unlines . filter ("ing" `isSuffixOf`) . words =<< getContents
(To be read from right to left.)
A Forth example would be interesting.
- Avshalom 16y agoHere 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!
- deleted 16y ago[deleted]