Nim iterators can be recursive, this is my iterator on arbitrarily nested
arrays or sequences to construct tensors.
iterator flatIter*[T](s: openarray[T]): auto {.noSideEffect.}=
## Inline iterator on any-depth seq or array
## Returns values in order
for item in s:
when item is array|seq:
for subitem in flatIter(item):
yield subitem
else:
yield item
Run
- What do you think about the programming language NIM? nickjonson
- Re: What do you think about the programming language ... dom96
- Re: What do you think about the programming langu... kidandcat
- Re: What do you think about the programming l... Stefan_Salewski
- Re: What do you think about the programmi... mratsim
- Re: What do you think about the prog... kidandcat
- Re: What do you think about the ... cantanima
- Re: What do you think about ... cdunn2001
- Re: What do you think about ... lscrd
- Re: What do you think about ... mratsim
- Re: What do you think about ... lscrd
- Re: What do you think about ... cblake
- Re: What do you think about ... Neil_H
- Re: What do you think about ... lscrd
- Re: What do you think about ... Kiloneie
- Re: What do you think about ... sschwarzer
- Re: What do you think about ... Neil_H
- Re: What do you think about ... Kiloneie
- Re: What do you think about ... jyelon
- Re: What do you think about ... Stefan_Salewski
