I ran into an interesting ObjectScript use case today with a general solution that I wanted to share.
Use case:
I have a JSON array (specifically, in my case, an array of issues from Jira) that I want to aggregate over a few fields - say, category, priority, and issue type. I then want to flatten the aggregates into a simple list with the total for each of the groups. Of course, for the aggregation, it makes sense to use a local array in the form:
agg(category, priority, type) = total
Such that for each record in the input array I can just: