String Abstraction
We abstract over strings and characters so that we do not rely on any specific encoding. We only need the following:
- a function to compute length of strings,
- a function to fetch a character at an index, and
- a function to check if two characters are equal.
length s
should compute the length of the string s
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.