Skip to content

Instantly share code, notes, and snippets.

import Control.Applicative
goodRoute :: (Real a) => [[a]] -> [a]
goodRoute = n . goodRoute_
where
goodRoute_ :: (Real a) => [[a]] -> Maybe [a]
goodRoute_ ([]:_) = Nothing
goodRoute_ [] = Nothing
goodRoute_ ((x:[]):[]) = Just (x:[])
goodRoute_ matrix =