Stable marriage problem: Difference between revisions

m
Line 2,756:
 
<lang Haskell>stableMatching :: Eq a => State a -> [Couple a]
stableMatching = getPairs . iterateUntiluntil (null._freeGuys) step
where
iterateUntil p f = head . dropWhile (not . p) . iterate f
getPairs s = map (_2 %~ head) $ s^.guys
 
Anonymous user