Skip to main content
Version: Next

or

Aggregate Function

or logical OR of input values

Synopsis

or(bool) -> bool

Description

The or aggregate function computes the logical OR over all of its input.

Examples

Ored value of simple sequence:

echo 'false true false' | super -z -c 'or(this)' -

=>

true

Continuous OR of simple sequence:

echo 'false true false' | super -z -c 'yield or(this)' -

=>

false
true
true

Unrecognized types are ignored and not coerced for truthiness:

echo 'false "foo" 1 true false' | super -z -c 'yield or(this)' -

=>

false
false
false
true
true

OR of values grouped by key:

echo '{a:true,k:1} {a:false,k:1} {a:false,k:2} {a:false,k:2}' |
super -z -c 'or(a) by k |> sort' -

=>

{k:1,or:true}
{k:2,or:false}