bind expression (:=) instead of let
Some checks failed
Build / build (push) Successful in 10m26s
Test / build (push) Failing after 16m44s

This commit is contained in:
Chuck Smith
2024-03-21 17:43:03 -04:00
parent 66d5453ecc
commit 6282075e66
36 changed files with 425 additions and 583 deletions

View File

@@ -1,21 +1,21 @@
let name = "Monkey";
let age = 1;
let inspirations = ["Scheme", "Lisp", "JavaScript", "Clojure"];
let book = {
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"
};
let printBookName = fn(book) {
let title = book["title"];
let author = book["author"];
printBookName := fn(book) {
title := book["title"];
author := book["author"];
print(author + " - " + title);
};
printBookName(book);
let fibonacci = fn(x) {
fibonacci := fn(x) {
if (x == 0) {
return 0
} else {
@@ -27,8 +27,8 @@ let fibonacci = fn(x) {
}
};
let map = fn(arr, f) {
let iter = fn(arr, accumulated) {
map := fn(arr, f) {
iter := fn(arr, accumulated) {
if (len(arr) == 0) {
return accumulated
} else {
@@ -39,5 +39,5 @@ let map = fn(arr, f) {
return iter(arr, []);
};
let numbers = [1, 1 + 1, 4 - 1, 2 * 2, 2 + 3, 12 / 2];
numbers := [1, 1 + 1, 4 - 1, 2 * 2, 2 + 3, 12 / 2];
map(numbers, fibonacci);