In this guide, we will discuss Clojure Predicates every? Returns true if the predicate is true for every value, else false.
Syntax
Following is the syntax.
(every? p1 col)
Parameters − ‘p1’ is the predicate which need to be tested. ‘col’ is the collection of values which needs to be tested.
Return Value − Returns true if the predicate is true for every value, else false.
Example
Following is an example of every? in Clojure.
(ns clojure.examples.example (:gen-class)) (defn Example [] (println (every? even? '(2 4 6))) (println (every? odd? '(2 4 6)))) (Example)
Output
The above program produces the following output.
true false
Next Topic : Click Here
Pingback: Clojure - Predicates every-pred | Adglob Infosystem Pvt Ltd
Pingback: Clojure - Predicates | Adglob Infosystem Pvt Ltd