Day 6 of my journey through Nim. I woke up refreshed and eager to understand 
the parsecsv module.

Very quickly I got to the point where I wanted to obtain the index position for 
a particular value in a sequence. A quick search led me to Stack Overflow 
([https://stackoverflow.com/questions/47638393/nim-find-the-index-of-an-item-in-an-array-or-sequence](https://stackoverflow.com/questions/47638393/nim-find-the-index-of-an-item-in-an-array-or-sequence))
 and a suggestion to use system.find()

I went to the appropriate docs page and found this:
    
    
    proc find[T, S](a: T; item: S): int {...}
    
    
    Run

I stared at that for awhile and then proceeded to try all of the following:
    
    
    var headers = @["one", "two", "three", "four", "five"]
    
    echo find["three",  headers]() # nope
    
    echo headers.find["three"] # nope
    
    echo headers.find("three") # Holy biscuits, YES!!!
    
    echo find(headers, "three") # YAYYYYYY!
    
    
    Run

I think the docs are great, but this isn't the 1st time I've misunderstood 
them. Could someone explain to me how I should interpret the syntax that's 
used? I happened to figure this one out because I happened to glance at the 
contains proc listed immediately below find in the doc.
    
    
    find(a, item) >= 0.
    
    
    Run

Reply via email to