Data and Math

vop

Venutian’s operators as functions you can pass to mapped, filtered and reduced.

Released v1.0.0 · 2026-09-28
Import
use "stdlib/op.ven"

Every operator as a plain function, such as op_add, ready to pass to mapped, filtered and reduced.

vop.ven
print reduced([1, 2, 3, 4], op_add, 0)
:: 10
Reference (16 functions)

API reference

op_add(a, b)

Adds two values with the native + operator.

print reduced([1, 2, 3, 4], op_add, 0)
:: prints: 10

op_subtract(a, b)

Subtracts b from a with the native - operator.

print op_subtract(5, 2)
:: prints: 3

op_multiply(a, b)

Multiplies two values with the native * operator.

print mapped([1, 2, 3], op_negate)
print reduced([1, 2, 3, 4], op_multiply, 1)
:: prints: 24

op_divide(a, b)

Divides a by b with the native / operator.

print op_divide(10.0, 4.0)
:: prints: 2.5

op_modulo(a, b)

Computes a modulo b with the native % operator.

print op_modulo(10, 3)
:: prints: 1

op_power(a, b)

print op_power(2, 5)
:: prints: 32

op_equals(a, b)

Tests whether two values are equal with the native == operator.

print op_equals(3, 3)
:: prints: yes

op_not_equals(a, b)

print op_not_equals(3, 4)
:: prints: yes

op_less_than(a, b)

Tests whether a is less than b with the native < operator.

print op_less_than(2, 3)
:: prints: yes

op_greater_than(a, b)

Tests whether a is greater than b with the native > operator.

print op_greater_than(3, 2)
:: prints: yes

op_less_or_equal(a, b)

Tests whether a is less than or equal to b with the native <= operator.

print op_less_or_equal(3, 3)
:: prints: yes

op_greater_or_equal(a, b)

Tests whether a is greater than or equal to b with the native >= operator.

print op_greater_or_equal(3, 2)
:: prints: yes

op_and(a, b)

Computes the logical and of two values with the native and operator.

print op_and(yes, no)
:: prints: no

op_or(a, b)

Computes the logical or of two values with the native or operator.

print op_or(yes, no)
:: prints: yes

op_not(a)

Computes the logical negation of a value with the native not operator.

print op_not(yes)
:: prints: no

op_negate(a)

Computes the arithmetic negation of a value with the unary - operator.

print mapped([1, 2, 3], op_negate)
:: prints: [-1, -2, -3]

Get notified when vop changes

Get notified about

New versions and security advisories.

New and updated packages, once a day.

News on the math model built in Venutian.