Working with list expressions
Cypher provides native support for lists. This means that not only are they treated as first-class entities, such as integers or strings, but all the functions that can create, manipulate, or process the lists are built into Cypher. Let us look at the following functions, all of which are available to process lists:
range
head
tail
last
size
reverse
reduce
As well as these functions, we can also use list comprehensions. First, we will take a look at the preceding functions, and then we will explore list comprehensions in greater depth.
Let us look at the range
function.
Working with the range function
The range
function provides a way to create a list with numbers. It takes a start
value and an end
value with an optional step
parameter and returns a list of all integer values bound by start
and end
. The syntax of the range
function is as follows:
range(start, end [, step])
The step
value is optional...