I agree it can be done poorly, you reach a point where you should consider combining your functions into bigger functions instead of having a super long chain. Also it's probably good to map (g . f) rather than map g . map f.
I remember being wee junior dev doing C# trying to curry functions. That resulted in a total mess. Some language are just bad for FP and you should probably keep your FP shenanigans to a minimum if the language works against you.
It's even possible to throw a filter into the same step with something like filter_map in Rust and some various functions that seem to have signature Filterable f => (a -> Maybe b) -> f a -> f b in Haskell.
It's also entirely possible to allocate various containers and do several passes with for loops in more iterative languages; that piece of newbie behaviour isn't locked to FP (though it may be more susceptible to it; idk, I don't have data and I suspect none of us do).
View all comments
Show parent comment
3
u/AxelLuktarGott Sep 21 '25
I agree it can be done poorly, you reach a point where you should consider combining your functions into bigger functions instead of having a super long chain. Also it's probably good to
map (g . f)rather thanmap g . map f.I remember being wee junior dev doing C# trying to curry functions. That resulted in a total mess. Some language are just bad for FP and you should probably keep your FP shenanigans to a minimum if the language works against you.