Coconut is a functional programming language that compiles to Python. Since all valid Python is valid Coconut, using Coconut will only extend and enhance what you're already capable of in Python.

Why use Coconut? Coconut is built to be useful. Coconut enhances the repertoire of Python programmers to include the tools of modern functional programming, in such a way that those tools are easy to use and immensely powerful; that is, Coconut does to functional programming what Python did to imperative programming. And Coconut code runs the same on any Python version, making the Python 2/3 split a thing of the past.

Installing Coconut is as easy as

  1. installing Python,
  2. opening a command-line prompt,
  3. and entering:
pip install coconut

which will give you access to all the features of Coconut, which adds to Python built-in, syntactical support for:

"hello, world!" |> print
(x) -> x ** 2
range(10) |> map$(pow$(?, 2)) |> list
match [head] + tail in [0, 1, 2, 3]:
    print(head, tail)
{"list": [0] + rest} = {"list": [0, 1, 2, 3]}
5 `mod` 3 == 2
product = reduce$(*)
(f .. g .. h)(x, y, z)
(| first_elem() |) :: rest_elems()
range(100) |> parallel_map$(pow$(2)) |> list
def factorial(n, acc=1):
    case n:
        match 0:
            return acc
        match _ is int if n > 0:
            return factorial(n-1, acc*n)
data Empty()
data Leaf(n)
data Node(l, r)

def size(Empty()) = 0

def size(Leaf(n)) = 1

def size(Node(l, r)) = size(l) + size(r)

and much more!

Ready to get started? Here are some links to help you out: