3 ms·
Using a good function syntax [Scala], the pointed version is: { x => Math.pow(2, x) } Obvious it's a function of 1 argument. The pointfree variant require
by pacala 9y ago
Using a good function syntax [Scala], the pointed version is:
{ x => Math.pow(2, x) }
Obvious it's a function of 1 argument. The pointfree variant requires 1 extra concept [partial], plus building a mental map of the arguments, to reconstruct what kind of a function [or value!] the pointfree expression represent.
Furthermore, implementing the reverse check is syntactically symmetric in the pointed version:
{ x => Math.pow(x, 2) }
Whereas the pointfree version, assuming the function is not commutative, accumulates even more concepts:
partial(flip(Math.pow), 2)
- mrkgnao 9y agoUsing even better (PureScript) syntax, the pointfree version of the latter can be written in notation similar to a hom-functor. f1 = pow 2 f2 = pow _ 2 This makes it look like a lambda but without having to bind an argument explicitly. Makes it much nicer to write complicated expressions (although I can't speak to the readability for people less fluent in the syntax).