Re: [Haskell-cafe] Period of a sequence

2011-07-02 Thread Henning Thielemann
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

Re: [Haskell-cafe] Period of a sequence

2011-06-27 Thread Steffen Schuldenzucker
On 06/26/2011 04:16 PM, michael rice wrote: MathWorks has the function seqperiod(x) to return the period of sequence x. Is there an equivalent function in Haskell? Could you specify what exactly the function is supposed to do? I am pretty sure that a function like seqPeriod :: (Eq a) =

Re: [Haskell-cafe] Period of a sequence

2011-06-27 Thread Richard O'Keefe
On 27/06/2011, at 8:32 PM, Steffen Schuldenzucker wrote: On 06/26/2011 04:16 PM, michael rice wrote: MathWorks has the function seqperiod(x) to return the period of sequence x. Is there an equivalent function in Haskell? Could you specify what exactly the function is supposed to do?

[Haskell-cafe] Period of a sequence

2011-06-26 Thread michael rice
MathWorks has the function seqperiod(x) to return the period of sequence x. Is there an equivalent function in Haskell? MichaelĀ ___ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe