Solution2.html

From HaskellWiki
Revision as of 16:41, 22 August 2012 by Pronate (talk | contribs) (New page: <haskell> parent :: Sheep -> Maybe Sheep parent s = father s `mplus` mother s grandparent :: Sheep -> Maybe Sheep grandparent s = paternalGrandfather s `mplus` paternalGr...)
(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)
Jump to navigation Jump to search
The printable version is no longer supported and may have rendering errors. Please update your browser bookmarks and please use the default browser print function instead.
parent :: Sheep -> Maybe Sheep
parent s = father s `mplus` mother s

grandparent :: Sheep -> Maybe Sheep
grandparent s = paternalGrandfather s `mplus` 
                paternalGrandmother s `mplus` 
                maternalGrandfather s `mplus` 
                maternalGrandmother s