I need to sum an element of an array with the element before and create a new array with this elements. In manual way now I am using this code:
match (a:User)
with collect(a.capital) as cap
with cap as cap, length(cap) as len
return cap[0],
cap[0]+cap[1],
cap[0]+cap[1]+cap[2],
cap[0]+cap[1]+cap[2]+cap[3],
cap[0]+cap[1]+cap[2]+cap[3]+cap[4],
cap[0]+cap[1]+cap[2]+cap[3]+cap[4]+cap[5],
cap[0]+cap[1]+cap[2]+cap[3]+cap[4]+cap[5]+cap[6],
len
But I need to use a query Cypher that do this operation on arrays with different lengths.