AROP

Since 1.1.0Arrays

Syntax

AROP key start end <SUM | MIN | MAX | AND | OR | XOR | MATCH value | USED>
  • Flags: readonly
  • ACL categories: @array, @read, @slow
  • Arity: -2

Computes over the filled slots from start to end.

OperationReply
SUM, MIN, MAXover the numeric values, as a bulk string; nil if there are none
AND, OR, XORof the integer values, as an integer
MATCH valuehow many values equal value
USEDhow many slots are filled

Examples

> ARSET n 0 3 7 hello 10
(integer) 4
> AROP n 0 3 SUM
"20"
> AROP n 0 3 MAX
"10"
> AROP n 0 3 MATCH hello
(integer) 1
> AROP n 2 2 SUM
(nil)