bruijn

pow [index (iterate (mul 0) (+1))]

…**… pow

:test ((+2) ** (+3) =? (+8)) (true)

Functional programming language based on pure de Bruijn indexed lambda calculus.

Hint: Click on anything you don't understand.

Lambdas all the way down.
No primitive functions.

> (+5)
[[[[2 (2 (1 3))]]]]
> 'a'
[[[1 (0 (0 (0 (0 (1 (1 (0 2)))))))]]]
> add
[[(([([[1 0 [[0]]]] ((((0 [[(((0...
> :time factorial (+42)
0.01 seconds

Efficient reduction using abstract machines and higher-order encodings.

Substantial standard library.
Source

>  (+1)  (+3) | ++‣
> number! <$> (lines "42\n25")
> sum (take (+3) (repeat (+4)))
> (+10b) ⋀! (+12b)
$ echo "main [0]" > echo.bruijn
$ bruijn -b echo.bruijn > echo
$ wc -c echo
2 echo
$ echo "hello world!" | bruijn -e echo
hello world!

Compilation to Tromp's binary lambda calculus.
Support for byte and ASCII encoding.

Meta-programming
and self-interpretation.

> length `factorial
> !(swap `((+2u) (+3u)))
> lhs (blc→meta "010000100000110")
Learn more: Wiki, Std, Samples

Installation

$ git clone https://github.com/marvinborner/bruijn.git && cd bruijn
$ stack run # for playing around
$ stack install
$ bruijn

Broogle

$ ./broogle.sh -f add
add ⧗ Unary → Unary → Unary
also known as …+…
in std/Number/Unary.bruijn:35
# adds two unary numbers
...

Why?

Articles

Open-source: GitHub