apoc.coll.zip
Syntax |
|
||
Description |
Returns the two given |
||
Arguments |
Name |
Type |
Description |
|
|
The list to zip together with |
|
|
|
The list to zip together with |
|
Returns |
|
Usage examples
The following combines two lists, element for element, into a list of lists using both APOC and Cypher:
apoc.coll.zip
WITH [1, 2, 3] AS list1, ["a", "b", "c"] AS list2
RETURN apoc.coll.zip(list1, list2) as output
Using Cypher’s UNWIND and COLLECT
WITH [1, 2, 3] AS list1, ["a", "b", "c"] AS list2
RETURN COLLECT {
UNWIND range(0, size(list1)-1) AS i
RETURN [list1[i], list2[i]]
} AS result
Output |
---|
[[1, "a"], [2, "b"], [3, "c"]] |