Being new to Nim I'm missing basic list/sequence functions like e.g. take.
var lst = @[1, 2, 3, 4, 5, 6, 7, 8, 9, 10]
for n in lst.take(5)
echo n
# 1
# 2
# 3
# 4
# 5
Run
I would also assume that there would be an iterator but I couldn't find any in
the documentation. Is there a reason for it? Like functional style in Nim is
discouraged? Or is there another more Nim idiomatic way to do it? Slices might
be used in this case but would throw an exception when the list is too short.
Enlightening welcome! :-)