Skip to content

clojure.core/fnil

View this page on ClojureDocs

Type: function Added: Clojure 1.2 Examples: 3 Runnable: 1
([f x] [f x y] [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.

Examples

by looselytyped on
by Dimagog on . May have evaluation errors.
by KyleErhabor on . May have evaluation errors.

See also


Content from the matching ClojureDocs page, with authors credited on each contribution.