4 ms·
> How else would you do it? There is a `splitWhitespace` iterator[1] in the Nim programming language as well and doesn't require a separate type. In Nim, the i
by dom96 9y ago
> How else would you do it?
There is a `splitWhitespace` iterator[1] in the Nim programming language as well and doesn't require a separate type. In Nim, the iterator is inlined.
1 - https://nim-lang.org/docs/strutils.html#splitWhitespace.i,string,int https://nim-lang.org/docs/strutils.html#splitWhitespace.i,st...
- dralley 9y agoIt's inlined in rust, too
- the_mitsuhiko 9y agoIterators in nim are also weird because many of them are not first class types and cannot be assigned to variables. I do not consider that to be a particularly good concept to be honest.
- dom96 9y agoThere are two types of iterators in Nim. The inlined variant is more efficient, and you can fairly easily wrap it in the other type: the "closure"" iterator. Why do you not consider it a good concept?
- the_mitsuhiko 9y agoBecause since we're comparing this with Rust right now which can achieve highly efficient iterators without sacrificing the ergonomics of it.