container list:_elem [
value:_elem
next:&:list:_elem
]
def push x:_elem, l:&:list:_elem -> l:&:list:_elem [
local-scope
load-ingredients
result:&:list:_elem <- new {(list _elem): type}
*result <- merge x, l
reply result
]
def first in:&:list:_elem -> result:_elem [
local-scope
load-ingredients
result <- get *in, value:offset
]
def rest in:&:list:_elem -> result:&:list:_elem/contained-in:in [
local-scope
load-ingredients
result <- get *in, next:offset
]
scenario list-handling [
run [
local-scope
x:&:list:num <- push 3, 0
x <- push 4, x
x <- push 5, x
10:num/raw <- first x
x <- rest x
11:num/raw <- first x
x <- rest x
12:num/raw <- first x
20:&:list:num/raw <- rest x
]
memory-should-contain [
10 <- 5
11 <- 4
12 <- 3
20 <- 0 <.calva/output-window/
.classpath
.clj-kondo/.cache
.cpcache
.DS_Store
.eastwood
.factorypath
.hg/
.hgignore
.java-version
.lein-*
.lsp/.cache
.lsp/sqlite.db
.nrepl-history
.nrepl-port
.portal
.project
.rebel_readline_history
.settings
.socket-repl-port
.sw*
.vscode
*.class
*.jar
*.swp
*~
/checkouts
/classes
/target