Re: Fuzzy matching on table keys

2019-02-13 Thread lqdev
Well, it sort of did. When implementing the `hash` method however, I realized it's not that simple, and decided to use something like this: import tables type FnSignatureTable = ref object signatures: TableRef[string, seq[FnSignature]] Run Then

Re: Fuzzy matching on table keys

2019-02-12 Thread cblake
What mashigan wrote may well be best suited to your exact purpose. Another possibility at least worth a shout out is `collections/critbits` which implements an efficient `keysWithPrefix`. For more fuzzy still than prefix matching, you could also do some kind of efficient edit distance-based

Re: Fuzzy matching on table keys

2019-02-12 Thread mashingan
Add `hash` function and equality operator `==` for custom key. import tables, hashes type Fn = proc (args: varargs[string]): int FnSignature = tuple name: string arity: int argTypes: seq[string] proc hash(fns: FnSignature): Hash =

Fuzzy matching on table keys

2019-02-12 Thread lqdev
Hello, I want to perform fuzzy matching on table keys. What I mean by that, is: import tables type Fn = proc (args: varargs[string]): int FnSignature = tuple name: string arity: int argTypes: seq[string] var signatures = newTable