https://github.com/jmid/myers-stack
An OCaml implementation of a Myers stack
https://github.com/jmid/myers-stack
Last synced: 10 months ago
JSON representation
An OCaml implementation of a Myers stack
- Host: GitHub
- URL: https://github.com/jmid/myers-stack
- Owner: jmid
- Created: 2014-08-13T13:40:43.000Z (over 11 years ago)
- Default Branch: master
- Last Pushed: 2014-08-22T12:27:25.000Z (over 11 years ago)
- Last Synced: 2025-01-29T11:27:27.788Z (12 months ago)
- Language: OCaml
- Size: 133 KB
- Stars: 0
- Watchers: 3
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
Myers stack
===========
This module implements a 'Myers stack' in OCaml.
The distinguishing feature of such stacks is arbitrary access in O(log n)
time and constant time length. The remaining operations match those of
OCaml's builtin singly-linked lists.
For more information, see Myers:IPL83 "An applicative random-access
stack" available here:
http://citeseerx.ist.psu.edu/viewdoc/summary?doi=10.1.1.188.9344
To build:
---------
On the command line simply run:
$ make
To run:
-------
On the command line run:
$ ocaml myers.cmo
OCaml version 4.01.0
# let l = Myers.fromlist ["0";"1";"2";"3";"4";"5";"6";"7"];;
val l : string Myers.t =
# Myers.length l;;
- : int = 8
# Myers.hd (Myers.tl (Myers.tl l));;
- : string = "2"
# Myers.nth l 4;;
- : string = "4"
# Myers.nth l 0;;
- : string = "0"
#