peach
A statically typed functional language.
fib =
0 => 1
1 => 1
x => (+ (fib (- x 1)) (fib (- x 2)))
(map fib [0 1 2 3 4 5 6 7 8 9 10])
# [ 1, 1, 2, 3, 5, 8, 13, 21, 34, 55, 89 ]
Syntax
Peach is inspired by JavaScript, Elm, Clojure and @bodil's BODOL, which I learned about from this awesome talk.
# x = 2 # 2 # # true # # 4 # `` if `` `` # = # # - = # # # # n: # x: a = => n => # , . a !
Semantics
- Static typing (with Damas-Hindley-Milner type inference)
- Pure functions
- Everything is an expression
- Immutability
- Strict evaluation
- Currying
Features
- Minimal syntax
- A tree-based JavaScript interpreter
- REPL
- Proper tails calls
Plans
Coming soon:
- Type hint syntax
- More stdlib
- Algebraic data types
And then:
- JavaScript interop
- JavaScript code generation
- Lazy sequences
- IO
One day:
- Efficient bytecode interpreter
- Interactive debugger
- Immutable data structures with structural sharing
- Self-hosting
Develop
Use Node 6+.
npm installnpm test