Skip to content

Arithmetic Provider

Hooks that perform arithmetic operations.

Hooks

Type Description Return
average Hook for taking the average of a list of numbers. int
modulo Hook for taking the modulo of an integer with optionally checking if it is equal to another number, 0 by default. int
sum Hook for summing a list of numbers. int

Examples

sum

Sum a list of numbers

total->: sum [1, 2, 3, 4, 5]
total: 15

average

Calculate the average of a list of numbers

avg->: average [1, 2, 3, 4, 5]
avg: 3.0

modulo

Take the modulo of a number

odd->: modulo 5 2
even->: modulo 6 2
odd: 1
even: 0