Example code:
(#
Simple program
#)
fn each(lst: list(t), fun: fn(t), index: int = 0)
lst.elem(index).fun()
match index < len(lst) - 1 then
true => each(lst, fun, index + 1)
end
end
record Book
title: string
author: string
end
books: list(Book) = {
@{
title => "Fear and Trembling",
author => "Johannas de Silentio"
}, @{
title => "Either/Or",
author => "Victor Eremita"
}, @{
title => "Concluding Unscientific Postscript",
author => "Johannas Climacus"
}
}
books.each(fn(book: Book) => print([[Title: #{book.title}
Author: #{book.author}]]))