EK Programming Language
EK is a mixfix dynamic functional strict and impure programming language.
Meaning:
- Mixfix: Functions and operators are the same thing, and can be defined as prefix, suffix, infix, or you can mix and match. How functions are called is completely customizable.
- Dynamically typed: Types are not known at compile time and have to be checked at runtime.
- Functional: The language is based on function composition. Everything is a function.
- Strict by default: Expressions are evaluated immediately, leading to less confusion around order of operations. Functions can choose to make arguments lazy, which is the case for
if
and&&
among others, to support short circuiting. - Impure: Functions can have side effects, such as printing, freely.
Hello World
import std
fn main = print "Hello, World!"
Fizz Buzz
import std
fn repeat (f) from (a) to (b)
= if a > b then void
else (f $ a) >> repeat f from (a + 1) to (b)
fn fizzbuzz (n)
= if n % 3 == 0 && n % 5 == 0
then "FizzBuzz"
else if n % 3 == 0
then "Fizz"
else if n % 5 == 0
then "Buzz"
else n toString
fn main = repeat print _ . fizzbuzz _ from 0 to 100
Other Features
- Import: Import functions defined in another file
- Lambda expressions
- Partial function applications, such as
fn increment = _ + 1
- Structs
- Lists (Implemented as a library)
GitHub Repository | Slides (French) | Getting Started with EK (Wiki)