package mula

  1. Overview
  2. Docs

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.
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.

OCaml

Innovation. Community. Security.