News for hackers. Stuff that matters.
Re:Functional programming jargon in plain English by skybrian on Monday July 04, 2022 @12:28PM (#31978839)
That's an example of why Haskell code is often hard to read, and why I'm glad this isn't available in other languages. Why not write out the callback given to map using a let block? Then you can give meaningful names to intermediate values so it's easier to see how the pipeline works.

(Though, functional programmers would probably pass up the opportunity and use one-letter variable names.)

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.