3 ms·
How would function composition work without currying? You'd have to name everything, wouldn't you? I'm thinking of how you could write in point-free style or e
by agentultra 6y ago
How would function composition work without currying? You'd have to name everything, wouldn't you?
I'm thinking of how you could write in point-free style or even have a `(.)` function to begin with if you had the Smalltalk "message passing" style.
Sure the Haskell syntax is a bit much when you're not familiar with it but, like almost any language, it's often the least-interesting part of the language and the most talked about.
- djhaskin987 6y agoThat's the whole point of the syntax changes: to make the tradeoff that sacrifices terseness or efficiency or even composability in favor of readability. A lot of functional languages -- Haskell as I understand it is the biggest perpetrator -- optimize for code length and composability, trying to make things as expressive as possible, and decrying those who can't read something that has meaning densely packed into every single character as those who are "simply not familiar" with the language. But that's what OP is saying: OO languages go for readability and not expressiveness, and wouldn't it be cool if there was an FP language that did the same thing?
- agentultra 6y agoI feel like that's a value statement and how you qualify readability would change the answer. I'm curious if Keli plans to maintain function composition in the face of named arguments. It would be quite nice to have both.
- smabie 6y agoAfter learning some array languages, functional languages like Haskell are actually pretty verbose. Moreover, I believe that in general, shorter code is more readable code. People just like to make excuses in order to avoid learning anything new.
- galimaufry 6y agoJust spitballing, but you could have composition eat the name of an input to the outer function: Given f(x,y) and g(z), write let q = (f .y g)(z=a) then q(y=b) = f(x=g(z=a), y=b) let q = (f .x g)(z=a) then q(z=a) = f(y=g(z=a), x=b) Aesthetically it would be kinda like the notation for fiber product.