1(* 2 Title: Standard Basis Library: List Signature 3 Author: David Matthews 4 Copyright David Matthews 1999, 2005, 2016 5 6 This library is free software; you can redistribute it and/or 7 modify it under the terms of the GNU Lesser General Public 8 License as published by the Free Software Foundation; either 9 version 2.1 of the License, or (at your option) any later version. 10 11 This library is distributed in the hope that it will be useful, 12 but WITHOUT ANY WARRANTY; without even the implied warranty of 13 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 14 Lesser General Public License for more details. 15 16 You should have received a copy of the GNU Lesser General Public 17 License along with this library; if not, write to the Free Software 18 Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA 19*) 20 21signature LIST = 22sig 23 datatype list = datatype list 24 (* G&R include the definition of list below in their "Interface". This is illegal. *) 25 (*datatype 'a list = nil | :: of 'a * 'a list *) 26 exception Empty 27 val null : 'a list -> bool 28 val length : 'a list -> int 29 val @ : ('a list * 'a list) -> 'a list 30 val concat : 'a list list -> 'a list 31 val revAppend : ('a list * 'a list) -> 'a list 32 val tabulate : (int * (int -> 'a)) -> 'a list 33 val hd : 'a list -> 'a 34 val tl : 'a list -> 'a list 35 val last : 'a list -> 'a 36 val getItem : 'a list -> ('a * 'a list) option 37 val nth : ('a list * int) -> 'a 38 val take : ('a list * int) -> 'a list 39 val drop : ('a list * int) -> 'a list 40 val rev : 'a list -> 'a list 41 42 val app : ('a -> unit) -> 'a list -> unit 43 val map : ('a -> 'b) -> 'a list -> 'b list 44 val mapPartial : ('a -> 'b option) -> 'a list -> 'b list 45 val find : ('a -> bool) -> 'a list -> 'a option 46 val filter : ('a -> bool) -> 'a list -> 'a list 47 val partition : ('a -> bool) -> 'a list -> ('a list * 'a list) 48 val foldl : (('a * 'b) -> 'b) -> 'b -> 'a list -> 'b 49 val foldr : (('a * 'b) -> 'b) -> 'b -> 'a list -> 'b 50 val exists : ('a -> bool) -> 'a list -> bool 51 val all : ('a -> bool) -> 'a list -> bool 52 53 val collate: ('a * 'a -> order) -> 'a list * 'a list -> order 54end; 55