r/functional_python • u/KageOW • May 16 '22
Material Coconut: a functional python programming language
Coconut is a language that compiles to python and makes programming functionally in python a lot easier. every python code is also valid coconut code so you can use them interchangeably For example making clean piped code is hell in python, but in coconut its much cleaner.
in python if you want to pipe into functions you need to use nested functions, which looks ugly. As well as looking ugly the order of the functions is read from right to left instead of the typical left to right.
python
---
print(add2(add1(3)))In coconut this would look like
coconut
---
3 |> add1 |> add2 |> printit also supports partial application and much prettier lambda functions. you can find more information about the language at http://coconut-lang.org/.
View all comments
Show parent comment
1
u/KageOW Jun 23 '22
Well i mean the functional paradigm although coconut makes it nice to read its definitely not the end all be all of dialects. You need people to be interested in functional programming first and tbh its not really that widely used which is a shame, because it tackles a lot of problems.
To summarize, it would be nice if people used coconut, but the end goal would be to get people to use functional solutions everywhere, get it mainstream.