Arithmetic Coder - Functional