Created
November 8, 2008 20:23
-
-
Save KirinDave/23126 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| class stack_of_ints = | |
| object (self) | |
| val mutable the_list = ( [] : int list ) (* instance variable *) | |
| method push x = (* push method *) | |
| the_list <- x :: the_list | |
| method pop = (* pop method *) | |
| let result = hd the_list in | |
| the_list <- tl the_list; | |
| result | |
| method peek = (* peek method *) | |
| hd the_list | |
| method size = (* size method *) | |
| length the_list | |
| end;; |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment