2 ms·
Well usually it would be for something that is useful, like const greaterThan = x => y => y > x and then I can do thins like numbers.filter(greaterThan(10))
by a-saleh 9y ago
Well usually it would be for something that is useful, like
const greaterThan = x => y => y > x
and then I can do thins like
numbers.filter(greaterThan(10))
because greatherThan(10) is a function (and I hope I did put the correct comparison operator :)
- masklinn 9y agoIt also works better on languages using free functions than those using method calls e.g. in Haskell you have filter :: (a -> Bool) -> [a] -> [a] so you partially apply to a predicate to get a specific filter condition which you can apply to various contexts e.g. over10 = filter (>= 10) That's why functional languages tend to put the callback first in HoFs, it's usually the more common partial application case.