module Exercise_6 where import Control.Arrow import Control.Monad import Data.Function import Data.List import Data.Maybe import Data.Ratio import GHC.Num {-MCCOMMENT If it wasn't for requiring the starting value in the list as well, I'd have the following 30-token solution using unfoldr: traceFractran fs = unfoldr `id` \n -> join (,) . numerator <$> find (eqInteger 1 . denominator) `id` map (fromIntegral n *) fs But alas, I was bested again it seems. -} {-WETT-} traceFractran :: [Rational] -> Integer -> [Integer] traceFractran fs n = n : (traceFractran fs . numerator & maybe [] $ eqInteger 1 . denominator & find $ map (fromIntegral n *) fs) {-TTEW-}