1
1
Fork 0
mirror of https://github.com/azur1s/bobbylisp.git synced 2024-10-16 02:37:40 -05:00
bobbylisp/example/iter.hz

23 lines
471 B
Plaintext
Raw Normal View History

2022-03-21 18:31:45 -05:00
fun iter_ (vec: vec_int) (current: int): void = do
if current == @len(vec) then
2022-04-03 03:07:25 -05:00
do end
2022-03-21 18:31:45 -05:00
else
do
2022-03-22 20:34:20 -05:00
-- iter logic
-- TODO: function as argument
2022-04-03 03:07:25 -05:00
@get(vec, current) |> @write(_)
@write("\n")
2022-03-22 20:34:20 -05:00
2022-04-03 03:07:25 -05:00
iter_(vec, current + 1)
end
end
end
2022-03-21 18:31:45 -05:00
fun iter (vec: vec_int): void = do
2022-04-03 03:07:25 -05:00
iter_(vec, 0)
end
2022-03-21 18:31:45 -05:00
fun main: void = do
2022-04-03 03:07:25 -05:00
let foo: vec_int = [69, 420, 727, 1337, 42069, 69420]
iter(foo)
end