control flow

This commit is contained in:
Peter
2024-01-15 08:30:03 +01:00
parent 1b4d8d622d
commit 613fa9ab1a
16 changed files with 400 additions and 23 deletions

View File

@@ -0,0 +1,90 @@
initialise-binding scope
(collateral
(bind
("fib",
function abstraction
(scope
(collateral
(map
( ),
map
( ),
map
( ),
bind
("n",
allocate-initialised-variable
(integers,
checked head
given))),
sequential
(if-else
(is-less-or-equal
(assigned
(bound
("n")),
decimal-natural
("1")),
scope
(collateral
(map
( )),
return assigned
(bound
("n"))),
null),
return int-add
(handle-return apply
(bound "fib",
list
(integer-subtract
(assigned
(bound
("n")),
decimal-natural
("1")))),
handle-return apply
(bound "fib",
list
(integer-subtract
(assigned
(bound
("n")),
decimal-natural
("2"))))))))),
map
( ),
map
( )),
sequential
(null,
scope
(bind
("n",
allocate-initialised-variable
(integers,
0)),
while
(is-less
(assigned
(bound
("n")),
decimal-natural
("8")),
sequential
(scope
(collateral
(map
( )),
print handle-return apply
(bound "fib",
list
(assigned
(bound
("n"))))),
assign
(bound "n",
int-add
(1,
assigned bound
"n")))))))