fava

fava: Functional Programming Language on Scala

View on GitHub

fava: Functional Programming Language on Scala

image image image image

fava is a pure functional programming language written in Scala, which was designed for the educational purpose in computational theory.

Features

Packages

Documents

Usage

$ java -jar build/libs/fava.jar
which language do you use?
[0]: fava
[1]: math
select: 0
fava$

Sample Codes

lambda calculus

fava$ ((x)=>(y)=>3*x+7*y)(2)(3)
27

Church booleans

fava$ ((l,r)=>l(r,(x,y)=>y))((x,y)=>x,(x,y)=>y)(true,false) // true & false
false
fava$ ((l,r)=>l((x,y)=>x,r))((x,y)=>x,(x,y)=>y)(true,false) // true | false
true

Church numerics

fava$ ((l,r)=>(f,x)=>l(f)(r(f)(x)))((f)=>(x)=>f(x),(f)=>(x)=>f(f(x)))((x)=>x+1,0) // 1 + 2
3
fava$ ((l,r)=>(f,x)=>l(r(f))(x))((f)=>(x)=>f(f(x)),(f)=>(x)=>f(f(x)))((x)=>x+1,0) // 2 * 2
4

anonymous recursion

fava$ ((f)=>((x)=>f(x(x)))((x)=>f(x(x))))((f)=>(n)=>(n==0)?1:n*f(n-1))(10)
3628800

Build

$ gradle build

Contribution

Feel free to contact @nextzlog on Twitter.

License

Author

無線部開発班 (JOURNAL OF HAMRADIO INFORMATICS LETTERS)

Clauses

BSD 3-Clause License