Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- import tables
- const kvPairs* = [
- (1i32, 2i16) ,
- (97i32, 71i16),
- (98i32, 73i16),
- (99i32, 74i16),
- ]
- proc toConstantTable*[A, B](pairs: static[openArray[(A, B)]]): Table[A, B] =
- ## creates a new hash table that contains the given `pairs`.
- result = initTable[A, B](rightSize(pairs.len))
- for key, val in items(pairs): result[key] = val
- const t = kvPairs.toConstantTable
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement