PROGRAM 1
(* filename: prog6.sml author: anthony f. ortiz *)
(* this program determines whether a pair of coordinates are less then *)
(* another pair of coordinates in lex order. *)
fun lex_order_less ((a: int, b: int), (c: int, d: int)): bool =
if a < c then
true
else
if a = c then
if b < d then
true
else
false
else
false;
lex_order_less ((1, 2), (3, 4));
lex_order_less ((1, 2), (1, 4));
lex_order_less ((1, 2), (1, 2));
lex_order_less ((1, 2), (1, 1));
lex_order_less ((1, 2), (0, 0));
(* filename: prog6.out author: anthony f. ortiz *)
Standard ML of New Jersey, Version 110.0.6, October 31, 1999 [CM; autoload enabl
ed]
- use "prog6.sml";
[opening prog6.sml]
val lex_order_less = fn : (int * int) * (int * int) -> bool
val it = true : bool
val it = true : bool
val it = false : bool
val it = false : bool
val it = false : bool
val it = () : unit
- ^Z
Stopped (user)
BACK TO CS6140 PAGE.