Start adding DT versions of LDT functions

This commit is contained in:
2025-07-10 21:36:52 +01:00
parent fd5f5105aa
commit 9543c2c789
4 changed files with 29 additions and 7 deletions
+15
View File
@@ -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)