On 26.06.2011 16:16, michael rice wrote:
MathWorks has the function seqperiod(x) to return the period of sequence x. Is there an equivalent function in Haskell?
seqperiod x = fst $ head $ filter (flip List.isPrefixOf x . snd) $ tail $ zip [0..] $ List.tails x
This relies on the fact, that p is a period of x, if isPrefixOf (drop p x) x . _______________________________________________ Haskell-Cafe mailing list [email protected] http://www.haskell.org/mailman/listinfo/haskell-cafe
