From 2d50ac913d773223ef13022f543e8ff7d71b7e09 Mon Sep 17 00:00:00 2001 From: Jimmy Byrd Date: Sun, 19 Mar 2023 18:46:33 -0400 Subject: [PATCH] renamed to batchMap --- .../AdaptiveHashMap/AdaptiveHashMap.fs | 12 ++++++------ .../AdaptiveHashMap/AdaptiveHashMap.fsi | 4 ++-- src/Test/FSharp.Data.Adaptive.Tests/AMap.fs | 2 +- 3 files changed, 9 insertions(+), 9 deletions(-) diff --git a/src/FSharp.Data.Adaptive/AdaptiveHashMap/AdaptiveHashMap.fs b/src/FSharp.Data.Adaptive/AdaptiveHashMap/AdaptiveHashMap.fs index 1400f64..7a55cb3 100644 --- a/src/FSharp.Data.Adaptive/AdaptiveHashMap/AdaptiveHashMap.fs +++ b/src/FSharp.Data.Adaptive/AdaptiveHashMap/AdaptiveHashMap.fs @@ -756,9 +756,9 @@ module AdaptiveHashMapImplementation = HashMapDelta.ofHashMap changes - /// Reader for batchRecalc operations. + /// Reader for batchMap operations. [] - type BatchRecalculateDirty<'k, 'a, 'b>(input : amap<'k, 'a>, mapping : HashMap<'k,'a> -> HashMap<'k, aval<'b>>) = + type BatchMap<'k, 'a, 'b>(input : amap<'k, 'a>, mapping : HashMap<'k,'a> -> HashMap<'k, aval<'b>>) = inherit AbstractReader>(HashMapDelta.empty) let reader = input.GetReader() @@ -1415,17 +1415,17 @@ module AMap = else create (fun () -> MapAReader(map, mapping)) - /// Adaptively applies the given mapping to all changes and reapplies mapping on dirty outputs - let batchRecalcDirty (mapping: HashMap<'K, 'T1> -> HashMap<'K, aval<'T2>>) (map: amap<'K, 'T1>) = + /// Adaptively applies the given mapping to batches of all changes and reapplies mapping on dirty outputs + let batchMap (mapping: HashMap<'K, 'T1> -> HashMap<'K, aval<'T2>>) (map: amap<'K, 'T1>) = if map.IsConstant then let map = force map |> mapping if map |> HashMap.forall (fun _ v -> v.IsConstant) then constant (fun () -> map |> HashMap.map (fun _ v -> AVal.force v)) else // TODO better impl possible - create (fun () -> BatchRecalculateDirty(ofHashMap map, id)) + create (fun () -> BatchMap(ofHashMap map, id)) else - create (fun () -> BatchRecalculateDirty(map, mapping)) + create (fun () -> BatchMap(map, mapping)) /// Adaptively chooses all elements returned by mapping. diff --git a/src/FSharp.Data.Adaptive/AdaptiveHashMap/AdaptiveHashMap.fsi b/src/FSharp.Data.Adaptive/AdaptiveHashMap/AdaptiveHashMap.fsi index c2acf8b..b5dc74b 100644 --- a/src/FSharp.Data.Adaptive/AdaptiveHashMap/AdaptiveHashMap.fsi +++ b/src/FSharp.Data.Adaptive/AdaptiveHashMap/AdaptiveHashMap.fsi @@ -105,8 +105,8 @@ module AMap = /// Adaptively applies the given mapping function to all elements and returns a new amap containing the results. val mapA : mapping: ('K -> 'V -> aval<'T>) -> map: amap<'K, 'V> -> amap<'K, 'T> - /// Adaptively applies the given mapping to all changes. - val batchRecalcDirty : mapping: (HashMap<'K,'T1> -> HashMap<'K,aval<'T2>>) -> map: amap<'K, 'T1> -> amap<'K, 'T2> + /// Adaptively applies the given mapping to batches of all changes and reapplies mapping on dirty outputs + val batchMap : mapping: (HashMap<'K,'T1> -> HashMap<'K,aval<'T2>>) -> map: amap<'K, 'T1> -> amap<'K, 'T2> /// Adaptively chooses all elements returned by mapping. val chooseA : mapping: ('K -> 'V -> aval>) -> map: amap<'K, 'V> -> amap<'K, 'T> diff --git a/src/Test/FSharp.Data.Adaptive.Tests/AMap.fs b/src/Test/FSharp.Data.Adaptive.Tests/AMap.fs index 2cdb401..9406b94 100644 --- a/src/Test/FSharp.Data.Adaptive.Tests/AMap.fs +++ b/src/Test/FSharp.Data.Adaptive.Tests/AMap.fs @@ -651,7 +651,7 @@ module AMap = >> HashMap.map(fun _ v -> AVal.constant v |> AVal.mapWithAdditionalDependencies (id) ) - AMap.batchRecalcDirty mapping map + AMap.batchMap mapping map []