sum

Full name: taxi.stdlib.sum

Signature

declare extension function <T,A> sum(collection: T[], callback: (T) -> A):A

Description

Returns the sum of values in the collection, computed by applying the selector function to each element.

find { order: Order } as {
   total: Price = order.items.sum((Item) -> Price)
}

Examples

Sums a numeric field across all elements of a collection.

Try it out

Schema
Query Plan
Play with this snippet by editing it here, or edit it on Taxi Playground
Result
Query failed
Next
Welcome to Taxi