1(* 2 * PIntMap: Maps over integers implemented as Patricia trees. 3 * Copyright (C) 2000 Jean-Christophe FILLIATRE 4 * 5 * This software is free software; you can redistribute it and/or 6 * modify it under the terms of the GNU Library General Public 7 * License version 2, as published by the Free Software Foundation. 8 * 9 * This software is distributed in the hope that it will be useful, 10 * but WITHOUT ANY WARRANTY; without even the implied warranty of 11 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. 12 * 13 * See the GNU Library General Public License version 2 for more details 14 * (enclosed in the file LGPL). 15 16 * Translated to SML by Michael Norrish, 2001. 17 *) 18 19signature PIntMap = 20sig 21 22type 'a t 23 24type key = int 25exception NotFound 26 27val empty : 'a t 28 29val add : int -> 'a -> 'a t -> 'a t 30 31val addf : ('a -> 'a) -> int -> 'a -> 'a t -> ('a t * 'a) 32 33val find : int -> 'a t -> 'a 34 35val remove : int -> 'a t -> 'a t 36 37val mem : int -> 'a t -> bool 38 39val app : (int * 'a -> unit) -> 'a t -> unit 40 41val map : ('a -> 'b) -> 'a t -> 'b t 42 43val mapi : (int -> 'a -> 'b) -> 'a t -> 'b t 44 45val fold : (int * 'a * 'b -> 'b) -> 'b -> 'a t -> 'b 46 47val choose : 'a t -> 'a t * (int * 'a) 48 49val size : 'a t -> int 50 51end 52