Parameter Make.1-St

String Abstraction

We abstract over strings and characters so that we do not rely on any specific encoding. We only need the following:

type ch

The type for characters

type t

The type for strings

val length : t -> int

length s should compute the length of the string s

val get : t -> int -> ch

get s i should fetch the character at index i of a string s

val equal : ch -> ch -> bool

equal c1 c2 should return true if c1 and c2 are equal, and false otherwise.