add 'env' parameter to gap_map.sml's mapper
This commit is contained in:
@@ -69,16 +69,16 @@ struct
|
|||||||
, rightVals: Pair.value vector list
|
, rightVals: Pair.value vector list
|
||||||
}
|
}
|
||||||
|
|
||||||
fun mapList (hd :: tl, acc) =
|
fun mapList (hd :: tl, acc, env) =
|
||||||
let val hd = Vector.map Map.map hd
|
let val hd = Vector.map (fn el => Map.map (el, env)) hd
|
||||||
in mapList (tl, hd :: acc)
|
in mapList (tl, hd :: acc)
|
||||||
end
|
end
|
||||||
| mapList ([], acc) = List.rev acc
|
| mapList ([], acc, env) = List.rev acc
|
||||||
|
|
||||||
fun map ({leftKeys, leftVals, rightKeys, rightVals}: t) : t =
|
fun map ({leftKeys, leftVals, rightKeys, rightVals}: t, env) : t =
|
||||||
let
|
let
|
||||||
val leftVals = mapList (leftVals, [])
|
val leftVals = mapList (leftVals, [], env)
|
||||||
val rightVals = mapList (rightVals, [])
|
val rightVals = mapList (rightVals, [], env)
|
||||||
in
|
in
|
||||||
{ leftKeys = leftKeys
|
{ leftKeys = leftKeys
|
||||||
, leftVals = leftVals
|
, leftVals = leftVals
|
||||||
@@ -943,28 +943,26 @@ struct
|
|||||||
removeRight (toRemove, leftKeys, leftVals, rightKeys, rightVals)
|
removeRight (toRemove, leftKeys, leftVals, rightKeys, rightVals)
|
||||||
end
|
end
|
||||||
| _ => removeLeft (toRemove, leftKeys, leftVals, rightKeys, rightVals)
|
| _ => removeLeft (toRemove, leftKeys, leftVals, rightKeys, rightVals)
|
||||||
end
|
end (* example usage of functor to map over GapMap:
|
||||||
|
structure Pair =
|
||||||
(* example usage of functor to map over GapMap:
|
struct
|
||||||
structure Pair =
|
type key = int
|
||||||
struct
|
type value = int
|
||||||
type key = int
|
|
||||||
type value = int
|
fun l (a: int, b: int) = a < b
|
||||||
|
fun eq (a: int, b: int) = a = b
|
||||||
fun l (a: int, b: int) = a < b
|
fun g (a: int, b: int) = a > b
|
||||||
fun eq (a: int, b: int) = a = b
|
|
||||||
fun g (a: int, b: int) = a > b
|
val maxNodeSize = 1024
|
||||||
|
end
|
||||||
val maxNodeSize = 1024
|
|
||||||
end
|
structure IntPair = MakeGapMap(Pair)
|
||||||
|
|
||||||
structure IntPair = MakeGapMap(Pair)
|
structure IntMap =
|
||||||
|
MakeGapMapMapper
|
||||||
structure IntMap =
|
(struct
|
||||||
MakeGapMapMapper
|
structure Pair = Pair
|
||||||
(struct
|
type env = ()
|
||||||
structure Pair = Pair
|
fun map x () = x * 5
|
||||||
type env = ()
|
end)
|
||||||
fun map x () = x * 5
|
*)
|
||||||
end)
|
|
||||||
*)
|
|
||||||
|
|||||||
Reference in New Issue
Block a user