1. Strings are indexed by char, at least if you use `[]` or `items()` on 
them. Nim has a "byte" type but it is not used frequently and just an alias for 
"uint8". It also has int8, uint8 and char which are all "a byte".
  2. `items()` is not a function so you can't call it like one. It is an 
iterator. Look up how it is implemented for strings: 
[here](https://github.com/nim-lang/Nim/blob/f795941f1fc2ee704b84016a869a474df2d5adee/lib/system.nim#L3431-L3438)
 and in general 
[here](https://github.com/nim-lang/Nim/blob/f795941f1fc2ee704b84016a869a474df2d5adee/lib/system.nim#L1964-L1969)
  3. `toSeq()` is not a function either but a template which will generate just 
the code one would write manually. I think you should really look up how it is 
implemented: 
[here](https://github.com/nim-lang/Nim/blob/f795941f1fc2ee704b84016a869a474df2d5adee/lib/pure/collections/sequtils.nim#L459-L483)
  4. I really mean you to look at the linked code in 2 and 3. That is "Nim" and 
how it works. Thats important! It also hopefully makes some stuff clear when 
you think about point 5.
  5. All "systems library" code is literally used when you compile. Same as the 
code you have written by yourself. There is no "better (faster) system library 
implementation" as in Python. Well, besides that those may sometimes have some 
clever tricks ... or not.
  6. Using constructs like the ones in Python may be as slow as they are in 
Python! Pythons implementation of some language constructs are just what Nim 
uses too. It is just native code working with garbage collected memory in a 
mostly naive fashion. So you may just get equivalent speeds. The real deal is 
to really use Nim.
  7. IMHO: Using Nim "counterfeit" as Python will bite you pretty soon. Nim is 
not Python and never will be. Learning Nim after having used Python is a good 
thing though.


Reply via email to