JanetDocsPlaygroundI'm feeling luckyGitHub sign in

all



    function
    boot.janet on line 2067, column 1

    (all pred xs)

    Returns true if `(pred item)` returns a truthy value for every item 
    in `xs`. Otherwise, returns the first falsey `(pred item)` result 
    encountered. Returns true if `xs` is empty.


See also:any?some2 examplesSign in to add an example
Loading...
# janet 1.10.1

(all pos? [1 2 3])     # => true
(all pos? [1 2 3 -4])  # => false
(all pos? [1 2 3 0])   # => false

(all (partial string/has-prefix? "a") ["aa" "ab"])       # => true
(all (partial string/has-prefix? "a") ["aa" "ab" "bb"])  # => false

(all truthy? [1 2])              # => true
(all truthy? [1 2 3])            # => true
(all truthy? [1 2 nil 3])        # => false
(all truthy? [1 false 2 nil 3])  # => false

(all (fn [x] x) [1 2])              # => 2
(all (fn [x] x) [1 2 3])            # => 3
(all (fn [x] x) [1 2 nil 3])        # => nil
(all (fn [x] x) [1 false 2 nil 3])  # => false
cellularmitosisPlayground
janet:2:> (all true? [true true false])
false
janet:3:> (all even? [2 4 6 7])
false
janet:5:> (all even? [2 4 6])
true
swlkrPlayground