The hash is built on a list where every even element is a key and the following odd element is its value.
Please comment if you can see problems or ways of bettering the functions.
The functions are now on Xelerus here
They are very simple to use.
Take an empty list, and begin adding, finding and removing items.
The only requirement is that keys remain unique.
Code: Select all
(setq hash (list)) (hshSet hash 'key1 'value) (hshSet hash 'key2 'somevar) (hshSet hash 'somevar '(a b c d e)) (hshGet hash 'key1) -> "value" (hshGet hash 'somevar) -> (a b c d e) (hshSet hash 'somevar 'override) (dbgOutput hash) -> (key1 value key2 somevar somevar override) (hshRemove hash 'key2) -> somevar (dbgOutput hash) -> (key1 value somevar override) ;; merge two hashes (setq hash2 '(test testvar key1 merge)) (hshMerge hash hash2) -> (key1 merge somevar override test testvar)