(* ========================================================================= *) (* NAME/ARITY PAIRS *) (* Copyright (c) 2004 Joe Leslie-Hurd, distributed under the BSD License *) (* ========================================================================= *)
structure NameArity :> NameArity = struct
(* ------------------------------------------------------------------------- *) (* A type of name/arity pairs. *) (* ------------------------------------------------------------------------- *)
type nameArity = Name.name * int;
fun name ((n,_) : nameArity) = n;
fun arity ((_,i) : nameArity) = i;
(* ------------------------------------------------------------------------- *) (* Testing for different arities. *) (* ------------------------------------------------------------------------- *)
fun nary i n_i = arity n_i = i;
val nullary = nary 0 and unary = nary 1 and binary = nary 2 and ternary = nary 3;
(* ------------------------------------------------------------------------- *) (* A total ordering. *) (* ------------------------------------------------------------------------- *)
fun compare ((n1,i1),(n2,i2)) = case Name.compare (n1,n2) of
LESS => LESS
| EQUAL => Int.compare (i1,i2)
| GREATER => GREATER;
Die Informationen auf dieser Webseite wurden
nach bestem Wissen sorgfältig zusammengestellt. Es wird jedoch weder Vollständigkeit, noch Richtigkeit,
noch Qualität der bereit gestellten Informationen zugesichert.
Bemerkung:
Die farbliche Syntaxdarstellung ist noch experimentell.