src/Pure/General/same.ML
changeset 32017 e91a3acf8383
parent 32015 7101feb5247e
child 32022 c2f4ee07647f
     1.1 --- a/src/Pure/General/same.ML	Thu Jul 16 17:03:11 2009 +0200
     1.2 +++ b/src/Pure/General/same.ML	Thu Jul 16 20:15:57 2009 +0200
     1.3 @@ -13,6 +13,7 @@
     1.4    val commit: 'a operation -> 'a -> 'a
     1.5    val function: ('a -> 'b option) -> ('a, 'b) function
     1.6    val capture: ('a, 'b) function -> 'a -> 'b option
     1.7 +  val map: 'a operation -> 'a list operation
     1.8  end;
     1.9  
    1.10  structure Same: SAME =
    1.11 @@ -32,5 +33,7 @@
    1.12      NONE => raise SAME
    1.13    | SOME y => y);
    1.14  
    1.15 +fun map f [] = raise SAME
    1.16 +  | map f (x :: xs) = (f x :: commit (map f) xs handle SAME => x :: map f xs);
    1.17  
    1.18  end;