TFL/utils.sml
changeset 10015 8c16ec5ba62b
parent 9876 a069795f1060
equal deleted inserted replaced
10014:d41ab495ab14 10015:8c16ec5ba62b
    81 fun zip3 [][][] = []
    81 fun zip3 [][][] = []
    82   | zip3 (x::l1) (y::l2) (z::l3) = (x,y,z)::zip3 l1 l2 l3
    82   | zip3 (x::l1) (y::l2) (z::l3) = (x,y,z)::zip3 l1 l2 l3
    83   | zip3 _ _ _ = raise UTILS_ERR{func="zip3",mesg="different lengths"};
    83   | zip3 _ _ _ = raise UTILS_ERR{func="zip3",mesg="different lengths"};
    84 
    84 
    85 
    85 
    86 fun can f x = (f x ; true) handle _ => false;
    86 fun can f x = (f x ; true) handle _ => false; (* FIXME do not handle _ !!! *)
    87 fun holds P x = P x handle _ => false;
    87 fun holds P x = P x handle _ => false; (* FIXME do not handle _ !!! *)
    88 
    88 
    89 
    89 
    90 fun sort R = 
    90 fun sort R = 
    91 let fun part (m, []) = ([],[])
    91 let fun part (m, []) = ([],[])
    92       | part (m, h::rst) =
    92       | part (m, h::rst) =