EdgeQL Tutorial

Sets

Subtopics

Functions in EdgeDB can operate on whole sets or on individual elements. This boils down to how the function parameters are defined, whether they are using SET OF modifier (indicating that the parameter will take a set as a whole) or not, although for built-in functions this is usually intuitive.

Let's try to use a simple element-wise function len (string or array length):

Input
Run
Output
Press the 'Run' button to evaluate the input

When a function which treats its parameters in element-wise fashion is applied to a set, a new set is constructed by applying the function to each original element separately. Try different sets as inputs to len:

Input
Run
Output
Press the 'Run' button to evaluate the input

If there are more than one element-wise function parameters, then the function is applied to the Cartesian product of the input sets. Try out different combinations using str_repeat:

Input
Run
Output
Press the 'Run' button to evaluate the input