src/Pure/Syntax/ast.ML
changeset 19473 d87a8838afa4
parent 17412 e26cb20ef0cc
child 19486 e04e20b1253a
equal deleted inserted replaced
19472:896eb8056e97 19473:d87a8838afa4
   127 
   127 
   128 fun fold_ast _ [] = raise Match
   128 fun fold_ast _ [] = raise Match
   129   | fold_ast _ [y] = y
   129   | fold_ast _ [y] = y
   130   | fold_ast c (x :: xs) = Appl [Constant c, x, fold_ast c xs];
   130   | fold_ast c (x :: xs) = Appl [Constant c, x, fold_ast c xs];
   131 
   131 
   132 fun fold_ast_p c = Library.foldr (fn (x, xs) => Appl [Constant c, x, xs]);
   132 fun fold_ast_p c = uncurry (fold_rev (fn x => fn xs => Appl [Constant c, x, xs]));
   133 
   133 
   134 
   134 
   135 (* unfold asts *)
   135 (* unfold asts *)
   136 
   136 
   137 fun unfold_ast c (y as Appl [Constant c', x, xs]) =
   137 fun unfold_ast c (y as Appl [Constant c', x, xs]) =