ClojureDocs

导航

命名空间

fnil

clojure.core

自 1.2 起可用 (源代码)
  • (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.