ClojureDocs

Nav

Namespaces

fnil

clojure.core

Available since 1.2 (source)
  • (fnil f x)
  • (fnil f x y)
  • (fnil f x y z)
Takes a function f, and returns a function that calls f, replacing
a nil first argument to f with the supplied value x. Higher arity
versions can replace arguments in the second and third
positions (y, z). Note that the function f can take any number of
arguments, not just the one(s) being nil-patched.