Project Description

Ela is a pure functional language with dynamic (and strong) typing. It provides an extensive support for the functional programming paradigm including but not limited to - first class functions and modules, curried function application, pattern matching, algebraic types, type classes, and much more. It also provides a support for both strict and non-strict evaluation.

The current language implementation is a light-weight and efficient interpreter written fully in C#. The interpreter was designed to be embeddable and has a clear and straightforward API. The language comes with a command line utility (Ela Console) that supports interactive mode and with a graphical development environment (Elide).

Why?

Ela can be used to study and teach functional programming, for prototyping, for writing theorem provers, for scripting, as well as for development of applications in a pure functional way. Ela comes with a rich standard library, interactive console and a graphical development environment. Ela also offers a flexible and powerful interface to .NET programming languages, such as C#.

Have questions? Join Ela news group!

Learn about Ela

 

Tools

Useful links

Code samples in Ela

Sieve of Eratosthenes
primes xs = sieve xs
  where sieve [] = []
        sieve (p::xs) = 
          & p :: sieve [& x \\ x <- xs | x % p > 0]

//Outputs: [2,3,5,7] 
primes [2..10]

Type classes
//Class with a function overloaded by return type
class Pointed a where
  point _->a 

//Instance for a linked list
instance Pointed List where
  point x = [x] 
  
point 42 ::: List //Outputs: [42]

Birthday paradox solver
birthday x num 
  | y < 0.5 = num + 1
  | else    = birthday y (num + 1)
  where y = (365 - num) / 365 * x

Infinite list filtering
lst = [1,4..]

filter' _ [] = []
filter' p (x::xs) 
  | p x  = & x :: filter' p xs
  | else = filter' p xs    

nlst = filter' (>10) lst

Lazy fix point combinator
fix' f = f (& fix' f)

factabs fact 0 = 1;
factabs fact x = x * fact (x - 1)

res = (fix' factabs) 5

Last edited Sep 7 at 2:16 PM by vorov2, version 42