JanetDocsSourcePlaygroundI'm feeling luckyCommunityGitHub sign in

all

core-api


    function
    boot.janet on line 2231, column 1

    (all pred ind & inds)

    Returns true if applying `pred` to every value in a data structure 
    `ind` results in only truthy values, but only if no `inds` are 
    provided. Multiple data structures can be handled if each `inds` is 
    a data structure and `pred` is a function of arity one more than 
    the number of `inds`. Returns the first falsey result encountered. 
    Note that `pred` is only called as many times as the length of the 
    shortest of `ind` and each of `inds`. If `ind` or any of `inds` are 
    empty, returns true.


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