Tables have contains proc, as well as arrays, seqs, openarrays, and other data 
structures.
    
    
    if myTable.contains(myKey) or mySeq.contains(myKey):
    

That said, there's a in and notin operators in nim which translate to the 
underlying contains call. So you can implement contains proc for your own data 
structure and in and notin will just work for it. 
    
    
    if myKey in myTable and myKey notin mySeq:
    

That said, contains proc for array-like structures is linear complexity. For 
big datasets you likely want to use HashSet instead.

Reply via email to