Functional paradigm - LHolten/Volpe GitHub Wiki
repeat val n func: (n = 0 -> val; recursive)
recursive: repeat (func val) (n - 1) func
result: repeat 0 10 func
func x: (x = 0 -> func 1; x + 1)
new_list^type(size): {
pointer = malloc(size * |type|)
:> (
resize(new_size): pointer <- ralloc(pointer, new_size * |type|)
update(index, value): pointer^type[index] <- value
get(index): pointer^type[index]
del: free(*pointer)
)
}
val: {
my_list = new_list^i8(10)
my_list.resize(5)
my_list.update(0, 30)
res = my_list.get(0)
my_list.del
:> res
}