
2 Jul
2011
2 Jul
'11
12:44 p.m.
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 .