Translating mathematics into code: Examples in Java, Python, Haskell and Racket
Discrete mathematical structures form the foundation of computer science.
These structures are so universal that most research papers in the theory of computation, programming languages and formal methods present concepts in terms of discrete mathematics rather than code.
The underlying assumption is that the reader will know how to translate these structures into a faithful implementation as a working program.
A lack of material explaining this translation frustrates outsiders.
What deepens that frustration is that each language paradigm encodes discrete structures in a distinct way.
Many of the encodings are as immutable, purely functional data structures (even in imperative languages), a topic unfortunately omitted from many computer science curricula. Many standard libraries provide only mutable versions of these data structures, which instantly leads to pitfalls.
via Translating mathematics into code: Examples in Java, Python, Haskell and Racket.