Commit f15016e3 authored by Pietro Abate's avatar Pietro Abate
Browse files

[r2003-07-29 09:48:11 by cvscast] Typo

Original author: cvscast
Date: 2003-07-29 09:48:11+00:00
parent 29c14865
......@@ -8,22 +8,13 @@ let stack = ref [Int*] []
(* (assignment), "!" (dereferencing), ";" (sequencing) *)
let fun push(x : Int) : [] =
stack := [x, !!stack]
stack := [x; !stack]
let fun pop ([] : []) : Int =
match !stack with [x ;y] -> stack := y; x | _ -> raise "Empty stack"
match !stack with [x; y] -> stack := y; x | _ -> raise "Empty stack"
(* In [ pattern ;y] the variable y captures the rest of the *)
(* sequence. It is equivalent to [pattern y::_*] *)
(* *)
(* Since sequences are encoded by pairs, we could write *)
(* the following [deprecated] equivalent definitions *)
(*
let fun push(x : Int) : [] =
stack := (x, !stack)
let fun pop ([] : []) : Int =
match !stack with (x, y) -> stack := y; x | _ -> raise "Empty stack"
*)
;;
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment