Advertisement
Guest User

Untitled

a guest
Jun 19th, 2018
58
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.79 KB | None | 0 0
  1. tamanho1 = cataNat (either (tamanho1) (add (p1) (p1.p2)))
  2. --tamanho1 :: QTree a -> Int
  3. --tamanho1 (Cell a b c) = b
  4. --tamanho1 (Block a b c d) = tamanho1(a) + tamanho1(b)
  5.  
  6. tamanho2 :: QTree a -> Int
  7. tamanho2 (Cell a b c) = c
  8. tamanho2 (Block a b c d) = tamanho2(a) + tamanho2(c)
  9.  
  10. auxcompressQTree :: QTree a -> Int -> QTree a
  11. auxcompressQTree y 0 = y
  12. auxcompressQTree y k = auxcompressQTree (g (y)) (k-1)
  13.  
  14. g b@(Cell a x y) = b
  15. g b@(Block (Cell a _ _) (Cell _ _ _) (Cell _ _ _) (Cell _ _ _)) = let x = tamanho1 b
  16. y = tamanho2 b
  17. in (Cell a (fromIntegral(x)) y)
  18. g h@(Block a b c d) = Block(g a) (g b) (g c) (g d)
  19.  
  20. compressQTree k y = auxcompressQTree y k
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement