Lambda

ReQL Lambda functions can be used for computations on sets of values.

Lambda functions take two arguments: a lambda expression and a set.

Lambda functions evaluate the lambda expression on every element of the set. The lambda expression can be any valid ReQL expression, and therefore can contain for example item properties or functions.

NameDescriptionExample
map

Applies the lambda expression to every member of a set

map(lambda 'x': 2*'x', {1, 2, 3}) == {2, 4, 6}
select

Returns only those values of input set for which the lambda expression returns true

select(lambda 'x': 'x' > 5, {10, 2, 13, 1}) == {10, 13}
exists

Returns true if lambda expression is satisfied for at least one element of the input set

exists(lambda 'x': 'x' > 5, {2, 13, 4})

Map applies the expression to every element and returns the result as set.

map(lambda 'x': EXPRESSION, input_set)
ArgumentType
lambda expression

lambda expression

input_set

set

All the following expressions result in true:

// Multiplies every element of the input set by two
map(lambda 'x': 2\*'x', {1, 2, 3}) == {2, 4, 6}

// Converts every element from the input set to number
map(lambda 'x': number('x'), {"1", "2", "3"}) == {1, 2, 3}

// Map applied on empty set is empty set
map(lambda 'x': 'x'*'x', {}) == {}

Select returns only those values of input set for which the lambda expression returns true. The lambda expression have to return a boolean.

select(lambda 'x': EXPRESSION, input_set)
ArgumentType
lambda expression

lambda expression returning boolean

input_set

set

All the following expressions result in true:

// Selects only the values that are greater than five
select(lambda 'x': 'x'>5, {10, 2, 13, 8, 3, 4, 7}) == {10, 13, 8, 7}

// ''true'' is satisfied for every element
select(lambda 'x': true , {1, "a", {}}) == {1, "a", {}}

// Selects only the strings, that are lowercase
select(lambda 'x': lower('x') == 'x', {"HELLO", "hello", "Hello", "a"}) == {"hello", "a"}

// No element represents a number with value less then 100
select(lambda 'x': number('x')<100 , {"125", "123", "251"}) == {}

Exists returns true if lambda expression returns true for at least one element of the input set. Otherwise returns false.

exists(lambda 'x': ...) can be though as shorthand for size(select(lambda 'x': ...)) > 0.

exists(lambda 'x': EXPRESSION, input_set)
ArgumentType
lambda expression

lambda expression returning boolean

input_set

set

All the following expressions result in true:

// Returns true, as 13 > 5
exists(lambda 'x': 'x'>5, {2, 13, 4})

// None of the elements is larger than 5
exists(lambda 'x': 'x'>5, {2, 1, 4}) == false
© Copyright 2026, Recombee s.r.o
docs.recombee.com