Kraeze has asked for the wisdom of the Perl Monks concerning the following question:
Dear Monks,
It is my first time asking a question here.
Background: I have used the perl api for Kyoto Cabinet, given here: http://fallabs.com/kyotocabinet/. I opted to use the B Tree implementation and would like to write my own comparator. As the keys are sorted lexicographically by default, it does not suit my keys.
My keys are stored as intervals e.g. "1-50", representing the start and end positions of bases in a biological sequence. Hence to order them I would compare only the first integer.
The only information I have found in the API is the following paragraph:
"The default record comparator is the lexical ordering function. That is, records in the B+ tree database are placed in the lexical order of each key. If you want to use another ordering, call `tune_comparator' to set a functor which implements the ordering function." Ref: Tuning the File Tree Database @ http://fallabs.com/kyotocabinet/spex.html
Question:How do I write my own comparator in perl? Thank you in advance.
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re: Howto: Comparator for B-Tree in Kyoto Cabinet
by Corion (Patriarch) on Jul 03, 2015 at 06:21 UTC | |
by Kraeze (Initiate) on Jul 03, 2015 at 11:51 UTC | |
|
Re: Howto: Comparator for B-Tree in Kyoto Cabinet
by QM (Parson) on Jul 03, 2015 at 08:16 UTC | |
by Kraeze (Initiate) on Jul 03, 2015 at 11:54 UTC |