4 ms·
Except for Prolog, I am familiar with all of the languages presented. Python and Haskell were the easiest for me to parse, not that any of them were overly hard
by megaman821 16y ago
Except for Prolog, I am familiar with all of the languages presented. Python and Haskell were the easiest for me to parse, not that any of them were overly hard.
- eru 16y agoPerhaps 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]