op:sequence-aggregate( $outCol as item(), $inCol as item(), [$options as map:map?] ) as map:map
This call constructs a sequence whose items are the values of a column for each row in the group or row set. The result is used for building the parameters used by the op:group-by function.
xquery version "1.0-ml"; import module namespace op="http://marklogic.com/optic" at "/MarkLogic/optic.xqy"; let $expenses := op:from-view("main", "expenses") return $expenses => op:group-by("Category", op:sequence-aggregate("Sequence Array", "Amount")) => op:order-by("Category") => op:result()