Keyboard shortcuts

Press or to navigate between chapters

Press S or / to search in the book

Press ? to show this help

Press Esc to hide this help

Aggregate Function

and — logical AND of input values

Synopsis

and(bool) -> bool

Description

The and aggregate function computes the logical AND over all of its input.

Examples

Anded value of simple sequence:

# spq
and(this)
# input
true
false
true
# expected output
false

Unrecognized types are ignored and not coerced for truthiness:

# spq
and(this)
# input
true
"foo"
0
false
true
# expected output
false

AND of values grouped by key:

# spq
and(a) by k | sort
# input
{a:true,k:1}
{a:true,k:1}
{a:true,k:2}
{a:false,k:2}
# expected output
{k:1,and:true}
{k:2,and:false}