Add code for determining item orientation
This commit is contained in:
@@ -15,6 +15,21 @@ singleLDT x = LDT x [] []
|
||||
ldtToDT :: LDTree b a -> DoubleTree a
|
||||
ldtToDT (LDT x l r) = DT x (map (ldtToDT . snd) l) (map (ldtToDT . snd) r)
|
||||
|
||||
ldtStartPropagate :: (a -> c) -> (c -> b -> a -> c) -> LDTree b a -> LDTree b c
|
||||
ldtStartPropagate g f (LDT x l r) = LDT z
|
||||
(fmap (\(j,t) -> (j,ldtPropagate' z j f t)) l)
|
||||
(fmap (\(j,t) -> (j,ldtPropagate' z j f t)) r)
|
||||
where
|
||||
z = g x
|
||||
|
||||
|
||||
ldtPropagate' :: c -> b -> (c -> b -> a -> c) -> LDTree b a -> LDTree b c
|
||||
ldtPropagate' x i f (LDT y l r) = LDT z
|
||||
(fmap (\(j,t) -> (j,ldtPropagate' z j f t)) l)
|
||||
(fmap (\(j,t) -> (j,ldtPropagate' z j f t)) r)
|
||||
where
|
||||
z = f x i y
|
||||
|
||||
-- propagate two functions down the links of an LDT tree
|
||||
-- which function is chosen depends on whether it is a left or right branch
|
||||
ldtPropagate ::
|
||||
|
||||
Reference in New Issue
Block a user