* Pure/library.ML: several combinators for linear functional transformations;
* Pure/library.ML: canonical list combinators fold, fold_rev, and fold_yield;
* Pure/term.ML: combinators fold_atyps, fold_aterms, fold_term_types, fold_types;
theory ToyList
imports PreList
begin
datatype 'a list = Nil ("[]")
| Cons 'a "'a list" (infixr "#" 65)
consts app :: "'a list => 'a list => 'a list" (infixr "@" 65)
rev :: "'a list => 'a list"
primrec
"[] @ ys = ys"
"(x # xs) @ ys = x # (xs @ ys)"
primrec
"rev [] = []"
"rev (x # xs) = (rev xs) @ (x # [])"