Created
July 19, 2014 23:29
-
-
Save llazzaro/a8cb2ad2f81691dc66d9 to your computer and use it in GitHub Desktop.
Ejercicio de Parcial Haskell
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
encontrarMinimo :: Perm a -> a -> Integer | |
encontrarMinimo permutacion x0 = foldr (\x rec -> if ((aplicarNVeces permutacion x0 x)== x0) then rec else rec + 1) 0 [0..] | |
ciclo :: Eq a => Perm a -> a -> a -> [a] | |
ciclo p inicial = [aplicarNVeces p inicial x| x <- [0..(encontrarMinimo p inicial)]] | |
aplicarNVeces :: Perm a -> a -> Int -> a | |
aplicarNVeces p x0 x = foldr (\x rec -> (p rec)) x0 [0..x] |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
donde uso [0..] es porque el enunciado decia que se sabia que existia el valor