Added a utility to call toy functions from C

This commit is contained in:
2022-10-01 13:51:40 +01:00
parent 976a9073f8
commit 256538e1f9
5 changed files with 390 additions and 24 deletions

View File

@@ -0,0 +1,23 @@
//create a bunch of toy functions as literals to be called from C
fn answer() {
return 42;
}
fn identity(x) {
return x;
}
fn makeCounter() {
var total = 0;
fn counter() {
return ++total;
}
return counter;
}
fn fail() {
assert false, "Failed correctly";
}