Hello Kashyap, While not particularly idiomatic, there is some application code here that uses idx, hash and friends which may be of some help, by way of example. Not recommending this for your use, just “yet another example”. :)
https://github.com/cryptorick/pil-KVMap/blob/master/KVMap.l Best, Rick