These functions sort of act like clojure.core/reduce
.
Order the items in the stream according to the provided function. If no function is provided, then a default sort order is used.
(q/query (g/get-vertices)
(q/property :name)
q/into-vec!)
;= ["lop" "vadas" "marko" "peter" "ripple" "josh"]
(q/query (g/get-vertices)
(q/property :name)
q/order
q/into-vec!)
;= ["josh" "lop" "marko" "peter" "ripple" "vadas"]
(q/query (g/get-vertices)
(q/property :name)
(q/order (fn [a b] (compare b a)))
q/into-vec!)
;= ["vadas" "ripple" "peter" "marko" "lop" "josh"]
Reverses the order of items in the stream.
(q/query (g/get-vertices)
(q/property :name)
q/order
q/into-vec!)
;= ["vadas" "ripple" "peter" "marko" "lop" "josh"]
Collect all objects up to that step and, optionally, process the gathered list with the provided function.
(q/query (g/find-by-id 1)
q/-->
q/id
q/gather
q/first-into-vec!)
;= ["2" "3" "4"]
(q/query (g/find-by-id 1)
q/-->
q/id
(q/gather count)
q/into-vec!)
;= [3]
You should read about filters next.
Please take a moment to tell us what you think about this guide on Twitter or the Titanium mailing list.
Let us know what was unclear or what has not been covered. Reader feedback is key to making the documentation better. If we know people are reading the documentation, we'll be much more inclined to make the documentation that much better. Please speak up!