Liking cljdoc? Tell your friends :D

n

like some->, except forms following n are treated as predicates that do not affect the value passed to the next form.

Along the river

Usage

(def person
  {:name "Nancy"
   :dog  "Claire"
   :age 37})

;; if the form following n evaluates to true, return previous value

(n person
   (:age)
   (inc)
   (n (> 35))) => 38

;; if the form following n evaluates to false, exit the thread with a nil
;; the following lines will not throw a NullPointerException

(n person
   (:age)
   (n (> 40))
   (+ 10)) => nil

Can you improve this documentation?Edit on GitHub

cljdoc is a website building & hosting documentation for Clojure/Script libraries

× close