language inspired of my view of functional programming and two day off
THINGS THAT WE DONT TOLERATE:
- null, so either 0
- currying,
because some problems with parser - anonymous values, because of readability
- reflection, because its unsafe
- OOP, because its hard :(
- exceptions (no usage = no exceptions)
- type casting (one type = no type casting)
- for/while, because its ineffective
- syntax sugar, because we dont want you to use this
- usage of this languages
some examples of programs:
fun min(first, second) = {
if (first < second) {
const c = first;
} else {
const c = second;
}
return c;
}
fun minWithFive(second) = {
const five = 5;
const res = min(five, second);
return res;
}
const one = 1;
const minFromOneAndFive = minWithFive(one);
print(minFromOneAndFive);
--------OUTPUT---------
1.0
fun fib(num) = {
if (num < 1) {
const fibRes = 1 - 1;
} else {
if (num < 3) {
const fibRes = 1;
} else {
const numMinusOne = num - 1;
const numMinusTwo = num - 2;
const fibMinusOne = fib(numMinusOne);
const fibMinusTwo = fib(numMinusTwo);
const fibRes = fibMinusOne + fibMinusTwo;
}
}
return fibRes;
}
const ten = 10;
const fibOfTen = fib(ten);
print(fibOfTen);
--------OUTPUT---------
55.0
fun map(n, mapper) = {
if (n < 1) {
const zero = 1 - 1;
const res = mapper(zero);
} else {
const mapped = mapper(n);
print(mapped);
const nMinusOne = n - 1;
const res = map(nMinusOne, mapper);
}
return res;
}
fun plusOneMapper(n) = {
const nPlusOne = n + 1;
return nPlusOne;
}
fun squareMapper(n) = {
const square = n * n;
return square;
}
const five = 5;
const mapResult = map(five, squareMapper);
print(mapResult);
--------OUTPUT---------
25.0
16.0
9.0
4.0
1.0
0.0