Translating mathematics into code: Examples in Java, Python, Haskell and Racket