summaryrefslogtreecommitdiff
path: root/doc
diff options
context:
space:
mode:
authorGravatar Adam Chlipala <adam@chlipala.net>2011-08-02 17:28:37 -0400
committerGravatar Adam Chlipala <adam@chlipala.net>2011-08-02 17:28:37 -0400
commit2d778aff9a95c2957e22df27091dc1789489ede0 (patch)
treedccc75e711b9c9a05ea3566c3a7af5be139a2016 /doc
parentbd572fc6e38f48574c8aa67e251ff1c184a6d340 (diff)
Improve detection of XML in urweb-mode; small tutorial improvement
Diffstat (limited to 'doc')
-rw-r--r--doc/intro.ur12
1 files changed, 8 insertions, 4 deletions
diff --git a/doc/intro.ur b/doc/intro.ur
index 02adfdd2..e3611567 100644
--- a/doc/intro.ur
+++ b/doc/intro.ur
@@ -259,20 +259,24 @@ signature STACK = sig
con t :: Type -> Type
val empty : a ::: Type -> t a
val push : a ::: Type -> t a -> a -> t a
- val pop : a ::: Type -> t a -> option a
+ val peek : a ::: Type -> t a -> option a
+ val pop : a ::: Type -> t a -> option (t a)
end
structure Stack : STACK = struct
con t = list
val empty [a] = []
fun push [a] (t : t a) (x : a) = x :: t
+ fun peek [a] (t : t a) = case t of
+ [] => None
+ | x :: _ => Some x
fun pop [a] (t : t a) = case t of
- [] => None
- | x :: _ => Some x
+ [] => None
+ | _ :: t' => Some t'
end
(* begin eval *)
-Stack.pop (Stack.push (Stack.push Stack.empty "A") "B")
+Stack.peek (Stack.push (Stack.push Stack.empty "A") "B")
(* end *)
(* Ur also inherits the ML concept of <b>functors</b>, which are functions from modules to modules. *)