loading...

Currying

James Robb on March 16, 2020

In mathematics and computer science, currying is a way of splitting a function which takes multiple arguments into a sequence of functions that tak... [Read Full]
markdown guide
 

Nice! Do you often use functional programming in your normal daily programming?
I personally prefer functional programming when possible but I'm always interested to hear what people like about it For me, a couple of the benefits of functional programming are the readability of the code and also the removal of boilerplate.

 

I try to use it as often as possible but working with different clients means that sometimes their systems are in OOP languages or some other paradigm and so using FP isn't always possible. It is something I find easier to reason with though personally since I aim to break any task down to the basics and this maps well with FP in my opinion. All I need to do is compose each task/action together to have the desired outcome and so using something like the compose function or pipe function is very useful in such scenarios.

 

I am very interested in adopting functional programming, for one simple reason: functions, being free of side effects, are easier to reason about and verify. The type of things I create benefit greatly from this attribute!

 

Agreed, it can give you a lot of freedom but other paradigms bring benefits of their own, it's really a balance always but if you keep functions simple and work them together logically it can work out pretty well for all involved.

 

I agree! I donโ€™t think switching exclusively is beneficial enough to do for exactly the reasons you stated, but I would benefit from using the ideas where they make sense.

Exactly and if you can break all tasks into small pieces, there's no reason why all your work couldn't just be function compositions but of course we don't live in such an ideal world although in a lot of cases it is feasible to do.

 

I had commented on another currying article on Dev.to over here, dev.to/eljayadobe/comment/o3p

Currying in JavaScript is "meh".
Currying in C++ is "omg, ow ow ow".
Currying in F# is "ahhh, nerdvana".

 
 

Slightly off-topic, but it is way to close to dinner time for this to keep going to the top of my feed and showing me a huge picture of a curry!

 

I felt the same and actually just ordered food not that long ago ๐Ÿ˜…

code of conduct - report abuse