X-Git-Url: http://git.joshuawise.com/snipe.git/blobdiff_plain/12aa4087bee3e70f170d7457794921de4e385227..HEAD:/util/symbol.sml diff --git a/util/symbol.sml b/util/symbol.sml index 590f9be..3111761 100644 --- a/util/symbol.sml +++ b/util/symbol.sml @@ -38,6 +38,12 @@ sig val elems : 'a table -> 'a list (* return all the data as a list *) val elemsi : 'a table -> (symbol * 'a) list (* return the symbols with the associated data *) val keys : 'a table -> symbol list (* just the symbols *) + val intersect : ('a * 'a -> 'a) -> 'a table * 'a table -> 'a table + + val mapi : (symbol * 'a -> 'b) -> 'a table -> 'b table + val mapPartial : ('a -> 'b option) -> 'a table -> 'b table + val mapPartiali : (symbol * 'a -> 'b option) -> 'a table -> 'b table + val appi : (symbol * 'a -> unit) -> 'a table -> unit (* symbol set -- similar to a () Symbol.table, elements can be removed *) type set @@ -103,6 +109,11 @@ struct fun elems t = Map.listItems t fun elemsi t = Map.listItemsi t fun keys t = Map.listKeys t + fun intersect binding (t1,t2) = Map.intersectWith binding (t1,t2) + fun mapi f t = Map.mapi f t + fun mapPartial f t = Map.mapPartial f t + fun mapPartiali f t = Map.mapPartiali f t + fun appi f t = Map.appi f t fun delimit' [] s = s | delimit' [x] s = s ^ x