2 ms·
The first example, (1..100).map(&'(1/_)+1') can be written in Haskell with sections and composition: map ((+1) . (1/)) [1..100] It's even shorter, if yo
by ionfish 17y ago
The first example,
(1..100).map(&'(1/_)+1')
can be written in Haskell with sections and composition:
map ((+1) . (1/)) [1..100]
It's even shorter, if you strip out the whitespace.
- raganwald 17y agoAlthough point-free style achieves (or surpasses) the brevity of anaphoric style, it does so in a manifestly different way. To use two Ruby examples, (1..100).map(&:to_s) (1..100).map(&it.to_s) The first example reads to me as mapping a method over the numbers, while the second reads to me as a very terse way of describing a function that sends a method to each number. I am not doing a good job of explaining the difference in my head, but I do know that sometimes I really like point-free style because I am thinking in operations and methods rather than in functions.