Let's code the functional way. This is a programming paradigm where we code "what" instead of "how". In this we can clearly separate "pure" code from "impure". You can code in any of the functional languages, including Haskell, Scala, Lisp, Erlang, Clojure, OCaml and F#.