Make torch use battery power
This commit is contained in:
@@ -38,6 +38,22 @@ ldtPropagateFold lf rf up x (LDT v l r) =
|
||||
. alaf Endo foldMap (\(s,y) -> ldtPropagateFold lf rf up (lf x v s (_ldtValue y)) y) l
|
||||
. up x v
|
||||
|
||||
-- Propgates a value (of type c) down the branches of the LDT.
|
||||
-- The value is updated according a "left" or "right" function (lf or rf),
|
||||
-- that acts on the parent value, the link, and the child value.
|
||||
-- For each node-tree, the updated value is used to update a final value (of type d).
|
||||
ldtPropagateFoldTree :: (c -> a -> b -> a -> c)
|
||||
-> (c -> a -> b -> a -> c)
|
||||
-> (c -> LabelDoubleTree b a -> d -> d)
|
||||
-> c
|
||||
-> LabelDoubleTree b a
|
||||
-> d
|
||||
-> d
|
||||
ldtPropagateFoldTree lf rf up x t@(LDT v l r) =
|
||||
alaf Endo foldMap (\(s,y) -> ldtPropagateFoldTree lf rf up (rf x v s (_ldtValue y)) y) r
|
||||
. alaf Endo foldMap (\(s,y) -> ldtPropagateFoldTree lf rf up (lf x v s (_ldtValue y)) y) l
|
||||
. up x t
|
||||
|
||||
ildtPropagate :: (Int -> c -> b -> c) -> (Int -> c -> b -> c)
|
||||
-> c
|
||||
-> LabelDoubleTree b a -> LabelDoubleTree c a
|
||||
|
||||
Reference in New Issue
Block a user