lots o fixes
Some checks failed
Build / build (push) Successful in 9m50s
Publish Image / publish (push) Failing after 49s
Test / build (push) Successful in 10m55s

This commit is contained in:
2024-04-01 18:18:45 -04:00
parent fe33fda0ab
commit 862119e90e
44 changed files with 326 additions and 170 deletions

43
examples/demo.m Normal file
View File

@@ -0,0 +1,43 @@
name := "Monkey";
age := 1;
inspirations := ["Scheme", "Lisp", "JavaScript", "Clojure"];
book := {
"title": "Writing A Compiler In Go",
"author": "Thorsten Ball",
"prequel": "Writing An Interpreter In Go"
};
printBookName := fn(book) {
title := book["title"];
author := book["author"];
println(author + " - " + title);
};
printBookName(book);
fibonacci := fn(x) {
if (x == 0) {
return 0
} else {
if (x == 1) {
return 1;
} else {
return fibonacci(x - 1) + fibonacci(x - 2);
}
}
};
map := fn(arr, f) {
iter := fn(arr, accumulated) {
if (len(arr) == 0) {
return accumulated
} else {
return iter(rest(arr), push(accumulated, f(first(arr))));
}
};
return iter(arr, []);
};
numbers := [1, 1 + 1, 4 - 1, 2 * 2, 2 + 3, 12 / 2];
map(numbers, fibonacci);