top | item 37366708

(no title)

pixel_tracing | 2 years ago

It _is_ literally increasing complexity. Because now the call stack has added layers of indirection:

[0] abort() [1] curry call site [2] partial closure 1 [3] partial closure 2 [4] partial closure 3 [5] partial closure 4 [6] <actual place of issue> [7] partial closure 5 [8] partial closure 6

Compare this to something isn’t using currying:

[0] abort() [1] call-site 1 [2] call-site 2 <actual place of issue> [3] call-site 3

Dealt with this enough at a previous company I’m glad on my team at FAANG people are reasonable and don’t just shoehorn functional paradigms unnecessarily

discuss

order

Clamchop|2 years ago

The curried example actually could only ever add one to the call stack, no matter how many times you do it.

And another thing, currying is one way of decomposing functions. Either your first example is decomposed too much or your second too little.

But I also am less comfortable working in a functional style.

noelwelsh|2 years ago

You're only looking at one dimension of complexity. There are tradeoffs.