Coconut is an open source programming language created in 2014.
#194on PLDB | 10Years Old |
git clone https://github.com/evhub/coconut
Simple, elegant, Pythonic functional programming.
print("Hello, world!")
"Hello World" |> print
Feature | Supported | Example | Token |
---|---|---|---|
Strings | ✓ | "Hello world" | " |
Print() Debugging | ✓ | ||
Algebraic Data Type | ✓ | data Empty() data Leaf(n) data Node(l, r) def size(Empty()) = 0 addpattern def size(Leaf(n)) = 1 addpattern def size(Node(l, r)) = size(l) + size(r) | |
Function Composition | ✓ | (f..g..h)(x, y, z) | |
Destructuring | ✓ | {"list": [0] + rest} = {"list": [0, 1, 2, 3]} | |
Anonymous Functions | ✓ | x -> x ** 2 | |
Infix Notation | ✓ | 5 `mod` 3 == 2 | |
Pattern Matching | ✓ | match [head] + tail in [0, 1, 2, 3]: print(head, tail) |