Core features of the language:
- Interpreted but plans to compile to JS or Go
- Infix expressions
- Pure functional, no assignments
- Map expression to support complicated expression:
{x = 23, y = x+2}
- Define closures with
fun(arg1, arg2,.. expression)
syntax - data:list and data:map provide ability to do filter/map
- wiki:table support
- general type system not yet implemented
- easy to add custom functions
- ability to import code
See the language in action here
go get github.com/funnelorg/funnel/cmd/funnel
# try: funnel -eval 1+2
# try: funnel -run <file>
# try: funnel
Funnel is a an experimental simple functional language.
The language has been designed to have very little by way of syntax:
Everything is just an infix expression with a small set of builtin
binary operators: + - * / . = , < > <= >= != == & |
and two grouping
operators ()
and {}
.
The curly braces functions as a "let expression":
{
x = <some_expression>,
y = x + x,
}
Everything else is done via runtime functions. Defining a function is
done via the fun
helper: fun(x, y, x+y)
The dot notation is used access the fields of a the {}
expression:
{
x = <some_expression>,
y = x + x,
}.y
The data:list
function provides ability to work with array-like
entites:
data:list(1, 2, 3).item(1)
Lists also support filter
and map
functions:
data:list(1, 2, 3).filter(index < 2 || value > 2)
data:list(1, 2, 3).map(value*2)
The data:map
functions provides access to filter
and map
on top
of the regular map expression:
data:map{x = 42}.filter(key == string x || value == 42)
Other functions include code:import(url)
to fetch and execute code
at url and wiki:table(string "Countries of the United Kingdom")
to
get a table from wikipedia
The main goal of the project is to play around with different type systems and reactive approaches. In particular, the short term goal is to figure out how to integrate this with the project (which provides data synchronization support but also the general mutability mechanism)