Start adding DT versions of LDT functions
This commit is contained in:
@@ -15,6 +15,21 @@ singleLDT x = LDT x [] []
|
||||
ldtToDT :: LDTree b a -> DTree a
|
||||
ldtToDT (LDT x l r) = DT x (map (ldtToDT . snd) l) (map (ldtToDT . snd) r)
|
||||
|
||||
dtStartPropagate :: (a -> c) -> (c -> a -> c) -> DTree a -> DTree c
|
||||
dtStartPropagate g f (DT x l r) = DT z
|
||||
(fmap (\(t) -> (dtPropagate' z f t)) l)
|
||||
(fmap (\(t) -> (dtPropagate' z f t)) r)
|
||||
where
|
||||
z = g x
|
||||
|
||||
|
||||
dtPropagate' :: c -> (c -> a -> c) -> DTree a -> DTree c
|
||||
dtPropagate' x f (DT y l r) = DT z
|
||||
(fmap (\(t) -> (dtPropagate' z f t)) l)
|
||||
(fmap (\(t) -> (dtPropagate' z f t)) r)
|
||||
where
|
||||
z = f x y
|
||||
|
||||
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)
|
||||
|
||||
Reference in New Issue
Block a user