treeDissectionCount :: Tree -> Partition -> Int
treeDissectionCount t (p:ps) = recurse p ps [([t],[])] where
  recurse :: Int -> Partition -> [Lumberyard] -> Int
  recurse n [] lumberyards = length $ concatMap (takeFromLumberyard n) lumberyards
  recurse n (c:cs) lumberyards
    | n == c    = recurse c cs $ concatMap (takeFromLumberyard n) lumberyards
    | otherwise = recurse c cs $ map (\(h, o) -> (h ++ o, [])) $ concatMap (takeFromLumberyard n) lumberyards
treeDissectionCount :: Tree -> Partition -> Int
treeDissectionCount t (p:ps) = recurse p ps [([t],[])] where
  recurse :: Int -> Partition -> [Lumberyard] -> Int
  recurse n [] lumberyards = length $ concatMap (takeFromLumberyard n) lumberyards
  recurse n (c:cs) lumberyards
    | n == c    = recurse c cs $ concatMap (takeFromLumberyard n) lumberyards
    | otherwise = recurse c cs $ map (\(h, o) -> (h ++ o, [])) $ concatMap (takeFromLumberyard n) lumberyards
treeDissectionCount t (p:ps) = recurse p ps [([t],[])] where
  recurse :: Int -> Partition -> [Lumberyard] -> Int
  recurse n [] lumberyards = length $ concatMap (takeFromLumberyard n) lumberyards
  recurse n (c:cs) lumberyards
    | n == c    = recurse c cs $ concatMap (takeFromLumberyard n) lumberyards
    | otherwise = recurse c cs $ map (\(h, o) -> (h ++ o, [])) $ concatMap (takeFromLumberyard n) lumberyards