Created
October 18, 2010 04:32
-
-
Save jsoffer/631714 to your computer and use it in GitHub Desktop.
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
type Nodo = (Int, (Integer,Integer)) | |
nivelArbolLista xs = concatMap g xs where | |
g (n, y) = [izq,der] where | |
izq = (n, fizq y) | |
der = (n+1, fder y) | |
fizq x = if even x | |
then quot x 2 | |
else quot (x + 3^n) 2 | |
fder x = if odd x | |
then quot (3*x + 1) 2 | |
else quot (3*x + 3^(n+1) + 1) 2 | |
arbol :: String | |
arbol = map (\k -> if k then '1' else '0') arbolB | |
arbolB :: [Bool] | |
arbolB = map odd arbolI | |
arbolI = map snd $ concat $ iterate nivelArbolLista [(2,8)] |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment