Re:Functional programming jargon in plain English
by jerf on Tuesday July 05, 2022 @10:04AM
(#31988313)
"It depends". My long pipelines were still usually nice to read because I had context-relevant names and I didn't tend to name them with single letters. You could still read off from them what they were doing. However honesty compels me to admit that by Haskell standards I tended to write long variable names. Not everywhere; there's a lot of "f" in Haskell for "functions that I only know about them that they are funcitons" for the same reason one you aren't winning in C by insisting that every for loop has to use a descriptive variable rather than "i". But I tended towards the longer.
In real code I probably would have named it, but example code is always silly.
Re:Functional programming jargon in plain English
by lgas on Monday July 04, 2022 @04:11PM
(#31981267)
Is this what you mean?
let f = makeMap x y
in map someFunc . filter other . map f $ userList
I suspect not as it certainly doesn't seem to improve the situation. Perhaps you could elaborate?Edit to add: I was focused on the "write out the callback given to map using a let block" part and not the meaningful name part, but that's perhaps what's confusing about this to me, as (makeMap x y) seems like the most clear name possible here, what else could you do? This?
let mapOfXy = makeMap x y
in map someFunc . filter other . map mapOfXy $ userList
It only obscures things.
Re:Functional programming jargon in plain English
by Iceland_jack on Monday July 04, 2022 @02:55PM
(#31980558)
The feature is not called currying but partial application, it is very nice and intuitive.
(Though, functional programmers would probably pass up the opportunity and use one-letter variable names.)