src/Pure/library.ML
changeset 42403 38b29c9fc742
parent 41516 3a70387b5e01
child 43278 1fbdcebb364b
     1.1 --- a/src/Pure/library.ML	Tue Apr 19 14:57:09 2011 +0200
     1.2 +++ b/src/Pure/library.ML	Tue Apr 19 15:58:05 2011 +0200
     1.3 @@ -93,7 +93,7 @@
     1.4    val find_first: ('a -> bool) -> 'a list -> 'a option
     1.5    val get_index: ('a -> 'b option) -> 'a list -> (int * 'b) option
     1.6    val get_first: ('a -> 'b option) -> 'a list -> 'b option
     1.7 -  val eq_list: ('a * 'b -> bool) -> 'a list * 'b list -> bool
     1.8 +  val eq_list: ('a * 'a -> bool) -> 'a list * 'a list -> bool
     1.9    val map2: ('a -> 'b -> 'c) -> 'a list -> 'b list -> 'c list
    1.10    val fold2: ('a -> 'b -> 'c -> 'c) -> 'a list -> 'b list -> 'c -> 'c
    1.11    val fold_rev2: ('a -> 'b -> 'c -> 'c) -> 'a list -> 'b list -> 'c -> 'c
    1.12 @@ -168,7 +168,7 @@
    1.13    val inter: ('a * 'b -> bool) -> 'b list -> 'a list -> 'a list
    1.14    val merge: ('a * 'a -> bool) -> 'a list * 'a list -> 'a list
    1.15    val subset: ('a * 'b -> bool) -> 'a list * 'b list -> bool
    1.16 -  val eq_set: ('a * 'b -> bool) -> 'a list * 'b list -> bool
    1.17 +  val eq_set: ('a * 'a -> bool) -> 'a list * 'a list -> bool
    1.18    val distinct: ('a * 'a -> bool) -> 'a list -> 'a list
    1.19    val duplicates: ('a * 'a -> bool) -> 'a list -> 'a list
    1.20    val has_duplicates: ('a * 'a -> bool) -> 'a list -> bool
    1.21 @@ -396,10 +396,11 @@
    1.22  (* basic list functions *)
    1.23  
    1.24  fun eq_list eq (list1, list2) =
    1.25 -  let
    1.26 -    fun eq_lst (x :: xs, y :: ys) = eq (x, y) andalso eq_lst (xs, ys)
    1.27 -      | eq_lst _ = true;
    1.28 -  in length list1 = length list2 andalso eq_lst (list1, list2) end;
    1.29 +  pointer_eq (list1, list2) orelse
    1.30 +    let
    1.31 +      fun eq_lst (x :: xs, y :: ys) = eq (x, y) andalso eq_lst (xs, ys)
    1.32 +        | eq_lst _ = true;
    1.33 +    in length list1 = length list2 andalso eq_lst (list1, list2) end;
    1.34  
    1.35  fun maps f [] = []
    1.36    | maps f (x :: xs) = f x @ maps f xs;