var dates = initOrderedTable[string, int]
When I do:
if dates.hasKey(theDate):
I get this error:
Error: type mismatch: got <proc (initialSize: int): OrderedTable[system.string, system.int]{.noSideEffect, gcsafe, locks: 0.}, string>** but expected one of:
- proc hasKey[A, B](t: Table[A, B]; key: A): bool
- first type mismatch at position: 1 required type for t: Table[hasKey.A, hasKey.B] but expression 'dates' is of type: proc (initialSize: int): OrderedTable[system.string, system.int]{.noSideEffect, gcsafe, locks: 0.}
- proc hasKey[A, B](t: OrderedTable[A, B]; key: A): bool
- first type mismatch at position: 1 required type for t: OrderedTable[hasKey.A, hasKey.B] but expression 'dates' is of type: proc (initialSize: int): OrderedTable[system.string, system.int]{.noSideEffect, gcsafe, locks: 0.}
- proc hasKey[A, B](t: TableRef[A, B]; key: A): bool
- first type mismatch at position: 1 required type for t: TableRef[hasKey.A, hasKey.B] but expression 'dates' is of type: proc (initialSize: int): OrderedTable[system.string, system.int]{.noSideEffect, gcsafe, locks: 0.}
- proc hasKey[A](t: CountTableRef[A]; key: A): bool
- first type mismatch at position: 1 required type for t: CountTableRef[hasKey.A] **but expression 'dates' is of type: proc (initialSize: int): OrderedTable[system.string, system.int]{.noSideEffect, gcsafe, locks: 0.}
- proc hasKey[A](t: CountTable[A]; key: A): bool
- first type mismatch at position: 1 required type for t: CountTable[hasKey.A] **but expression 'dates' is of type: proc (initialSize: int): OrderedTable[system.string, system.int]{.noSideEffect, gcsafe, locks: 0.}
- proc hasKey[A, B](t: OrderedTableRef[A, B]; key: A): bool
- first type mismatch at position: 1 required type for t: OrderedTableRef[hasKey.A, hasKey.B] but expression 'dates' is of type: proc (initialSize: int): OrderedTable[system.string, system.int]{.noSideEffect, gcsafe, locks: 0.}
expression: hasKey(dates, theDate)
In this error I see an occurrence of OrderedTable (#2 in the list) which seems appropriate in my case (however, I am still a Num n00b ;-).
Please help! TIA
var dates = initOrderedTable[string, int]()
You need () because it is a proc call.