Skip to content

Instantly share code, notes, and snippets.

View dbricehg's full-sized avatar

Daniel Brice dbricehg

  • HG Insights
  • Santa Barbara, California
View GitHub Profile
@evincarofautumn
evincarofautumn / Roommates.hs
Last active June 12, 2020 21:54
Heuristic stable roommates with k-person rooms by approval voting
import Data.Ord (Down(..), comparing)
import Data.List (permutations, sortBy)
import Data.Maybe (listToMaybe)
import qualified Data.Set as Set
-- | A matrix of approval votes. @forall (a :: 'Approvals'). a !! i !! j@
-- is the number of approval votes that person @i@ awarded to person @j@.
type Approvals = [[Int]]
-- | List of list of indices representing a partition of a list. Invariant:
@sorki
sorki / ghci.conf
Created August 30, 2018 13:02
ghci colors (~/.ghc/ghci.conf)
import Control.Applicative
import Control.Monad
import Control.Concurrent
import Data.String
import Data.Char
import Data.List
import Data.Monoid
import Control.Monad.IO.Class