Languages Features Creators CSV Resources Challenges Add Language
GitHub icon

Coconut

Coconut - Programming language

< >

Coconut is a programming language created in 2014.

#330on PLDB 9Years Old 3.8kUsers
0Books 0Papers

Try now: Web · Riju · TIO

Simple, elegant, Pythonic functional programming.


Example from Riju:
print("Hello, world!")
Example from hello-world:
"Hello World" |> print

Language features

Feature Supported Token Example
Strings ✓ "
"Hello world"
Print() Debugging ✓ print
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)
x86-64-isa.html · coconut.html · wisp.html

View source

- Build the next great programming language · Search · Day 213 · About · Blog · Acknowledgements · Traffic · Traffic Today · GitHub · feedback@pldb.com