Yit Phang Khoo avatar Yit Phang Khoo committed b742388

Minor refactoring of SAArrayMappedTrie.add to avoid passing arguments unnecessarily.

Comments (0)

Files changed (1)


         (** Create memoizing constructor and updater that adds a binding to an self-adjusting array mapped trie. *)
         let memo_add =
             let add, update_add = A.memo3 (module A) (module Types.Int) (module R) begin fun _ xs k v ->
-                let rec add xs s k v =
+                let rec add xs s =
                     (* if along k, initialize the next branch/leaf node, else lookup the subtrie under the prior AMT *)
                     if s > 0 then
                         Branches begin LazySparseArray.make begin fun d ->
                             if k lsr s land mask == d then
-                                Some (add xs (s - bits) k v)
+                                Some (add xs (s - bits))
                                 (* perform a partial key lookup for the corresponding subtrie under the prior AMT *)
                                 let rec subtrie xs s' = match xs with
                                 get xs (k land mask' lor d)
                         end end
-                add xs key_bits' k v
+                add xs key_bits'
             end in
             let add xs k v =
                 if k < 0 || k >= size then invalid_arg "index out of bounds";
Tip: Filter by directory path e.g. /media app.js to search for public/media/app.js.
Tip: Use camelCasing e.g. ProjME to search for ProjectModifiedEvent.java.
Tip: Filter by extension type e.g. /repo .js to search for all .js files in the /repo directory.
Tip: Separate your search with spaces e.g. /ssh pom.xml to search for src/ssh/pom.xml.
Tip: Use ↑ and ↓ arrow keys to navigate and return to view the file.
Tip: You can also navigate files with Ctrl+j (next) and Ctrl+k (previous) and view the file with Ctrl+o.
Tip: You can also navigate files with Alt+j (next) and Alt+k (previous) and view the file with Alt+o.