4 ms·
And here's the GP's other example: (putStrLn{9} . show{8} . sum{7} . map{5} read{6} . filter{4} (not{3} . null{2}) . split '+'{1}) "28+32+++32++39" and he
by tome 13y ago
And here's the GP's other example:
(putStrLn{9} . show{8} . sum{7} . map{5} read{6} . filter{4} (not{3} . null{2}) . split '+'{1}) "28+32+++32++39"
and here's ak217's Python version:
expr{1} = '28+32+++32++39'
print{8} sum{7}(int(i){6} for i in expr.split('+'){2} if{5} i is not ''{4})
Actually, I prefer your Factor example even more than the Haskell (even though I've never heard of the language) because the order of operations is more natural to me, but really I don't think the proposition "Haskell's syntax [is] a bad example in language syntax" has been demonstrated. Comprehensions in Python and in Haskell are an impediment to composability as I mentioned in another post on this story.
- justinpombrio 13y agoIndeed, concatenative languages are written in a very natural way. I wonder if they wouldn't make good teaching languages: you have to learn about a stack, but the evaluation order is trivial (do the first thing, then the second, ...), and there are no variables to contend with. Haskell programs, on the other hand, are clearly written backwards :-)