Why does Clojure, despite such an emphasis on functional paradigm, not use the Maybe
/ Option
monad to represent optional values? The use of O
Going with @amalloy and comments that Clojure, as a language, doesn't have a need for an optional return value.
I haven't done much with Scala, but Clojure doesn't need to know the strict details about the return type to be able to work with a value. It's almost as if a Maybe monad was embedded and made a part of normal Clojure evaluation, as many of the operations, if performed on nil
, return nil
.
I took a quick look at the Clojure-Contrib library, and they have a monad package which you may want to look at. Another item which really clued me into how one would make use of Monads in Clojure, is Cosmin's tutorial on Monads in Clojure. It was this that help me connect how the functionality that is stated more explicitly in Scala is handled as part of the dynamic Clojure language.