triple_swap;
authorwenzelm
Wed, 14 Apr 1999 19:05:28 +0200
changeset 6430 69400c97d3bf
parent 6429 9771ce553e56
child 6431 a42bdc45130d
triple_swap;
src/HOL/Tools/inductive_package.ML
src/HOL/Tools/primrec_package.ML
src/Pure/Isar/outer_parse.ML
--- a/src/HOL/Tools/inductive_package.ML	Wed Apr 14 19:05:10 1999 +0200
+++ b/src/HOL/Tools/inductive_package.ML	Wed Apr 14 19:05:28 1999 +0200
@@ -646,7 +646,7 @@
 local open OuterParse in
 
 fun mk_ind coind (((sets, intrs), monos), con_defs) =
-  #1 o add_inductive true coind sets (map (fn ((x, y), z) => ((x, z), y)) intrs) monos con_defs;
+  #1 o add_inductive true coind sets (map triple_swap intrs) monos con_defs;
 
 fun ind_decl coind =
   Scan.repeat1 term --
--- a/src/HOL/Tools/primrec_package.ML	Wed Apr 14 19:05:10 1999 +0200
+++ b/src/HOL/Tools/primrec_package.ML	Wed Apr 14 19:05:28 1999 +0200
@@ -270,7 +270,7 @@
 val primrecP =
   OuterSyntax.command "primrec" "define primitive recursive functions on datatypes"
     (primrec_decl >> (fn (alt_name, eqns) =>
-      Toplevel.theory (#1 o add_primrec alt_name (map (fn ((x, y), z) => ((x, z), y)) eqns))));
+      Toplevel.theory (#1 o add_primrec alt_name (map triple_swap eqns))));
 
 val _ = OuterSyntax.add_parsers [primrecP];
 
--- a/src/Pure/Isar/outer_parse.ML	Wed Apr 14 19:05:10 1999 +0200
+++ b/src/Pure/Isar/outer_parse.ML	Wed Apr 14 19:05:28 1999 +0200
@@ -57,6 +57,7 @@
   val method: token list -> Method.text * token list
   val triple1: ('a * 'b) * 'c -> 'a * 'b * 'c
   val triple2: 'a * ('b * 'c) -> 'a * 'b * 'c
+  val triple_swap: ('a * 'b) * 'c -> ('a * 'c) * 'b
 end;
 
 structure OuterParse: OUTER_PARSE =
@@ -96,6 +97,7 @@
 
 fun triple1 ((x, y), z) = (x, y, z);
 fun triple2 (x, (y, z)) = (x, y, z);
+fun triple_swap ((x, y), z) = ((x, z), y);
 
 
 (* tokens *)