Skip to content

Instantly share code, notes, and snippets.

View tuohuang-li's full-sized avatar
:octocat:

Tuohuang Li tuohuang-li

:octocat:
  • @ Unimelb
  • Melbourne
View GitHub Profile
@davenportw15
davenportw15 / HashMap.hs
Created September 7, 2015 05:51
A hashmap implementation in Haskell backed by a binary tree.
module HashMap where
import Prelude hiding (lookup)
-- | HashMap backed by a binary tree. Most operations are O(log(n))
data HashMap k v = EmptyMap | Map (k, v) (HashMap k v) (HashMap k v) deriving (Read, Show)
-- | Apply fmap over all values
instance (Ord k) => Functor (HashMap k) where
@saltavenger
saltavenger / hangman
Created October 23, 2012 14:45
python hangman
# 6.00 Problem Set 3
#
# Hangman game
#
# -----------------------------------
# Helper code
# You don't need to understand this helper code,
# but you will have to know how to use the functions
# (so be sure to read the docstrings!)