Skip to content

CharlieKerfoot/hashmap-haskell

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

2 Commits
 
 
 
 
 
 
 
 

Repository files navigation

Hashmap in Haskell

Hashmap built out in Haskell. Pretty self explanatory.

Hashmaps (or hash tables) are efficent data structures that allow for O(1) access using keys. They are essentially a wrapper around an array, but allow for access with strings rather than simply integer indixes. This is accomplished by taking advantage of a hash function, which tries to assign each input string (key) with a unique array.

Functions

Function Description
djb2Hash A pretty efficent and effective hash function with rare collisions. See more
createHashMap Creates a hashmap with a given default size and desired hash function (presumably djb2Hash)
lookupKey Returns the desired value when given a key and specified hashmap
insertKey Add a new key-pair value into the hashmap
insertWith Add a new key-pair value while applying a specified funcion to the value

Usage

First build the project:

cabal build 

Then, run the tests:

cabal run

You output should look something like this:

Cases: 5 Tried: 5 Errors: 0 Failures: 0

License

MIT

About

Hash Map built out in Haskell

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published