| author | haftmann | 
| Wed, 18 Jul 2018 20:51:23 +0200 | |
| changeset 68660 | 4ce18f389f53 | 
| parent 57804 | fcf966675478 | 
| permissions | -rw-r--r-- | 
| 47269 | 1  | 
theory MyList  | 
2  | 
imports Main  | 
|
3  | 
begin  | 
|
4  | 
||
| 47302 | 5  | 
datatype 'a list = Nil | Cons 'a "'a list"  | 
| 47269 | 6  | 
|
7  | 
fun app :: "'a list => 'a list => 'a list" where  | 
|
8  | 
"app Nil ys = ys" |  | 
|
9  | 
"app (Cons x xs) ys = Cons x (app xs ys)"  | 
|
10  | 
||
11  | 
fun rev :: "'a list => 'a list" where  | 
|
12  | 
"rev Nil = Nil" |  | 
|
13  | 
"rev (Cons x xs) = app (rev xs) (Cons x Nil)"  | 
|
14  | 
||
15  | 
value "rev(Cons True (Cons False Nil))"  | 
|
16  | 
||
| 57804 | 17  | 
(* a comment *)  | 
18  | 
||
| 47269 | 19  | 
end  |