encode maps a value of type t to a unique integer code. If applied twice to the same value, encode returns the same code; if applied to a value that has never been encountered, it returns a fresh code.
val current : unit -> int
current() returns the next available code, which is also the number of values that have been encoded so far.