catala/tests/test_array/good/aggregation.catala_en

Ignoring revisions in .git-blame-ignore-revs. Click here to bypass and see the normal blame view.

40 lines
959 B
Plaintext
Raw Normal View History

## Article
```catala
declaration scope A:
output x content collection money
scope A:
definition x equals [$0; $4 + $5; $8 * 0.65]
declaration scope B:
a scope A
output max content money
output min content money
output y content money
output z content integer
scope B:
definition max equals maximum of (m * 2.0) for m among a.x
or if collection empty then $0
definition min equals minimum of (m + $5) for m among a.x
or if collection empty then $20
definition y equals sum money of (m + $1) for m among a.x
definition z equals number of m among a.x such that m >= $8.95
```
```catala-test-inline
$ catala Interpret -s A
[RESULT] Computation successful! Results:
[RESULT] x = [$0.00; $9.00; $5.20]
```
```catala-test-inline
$ catala Interpret -s B
[RESULT] Computation successful! Results:
[RESULT] max = $18.00
[RESULT] min = $5.00
[RESULT] y = $17.20
[RESULT] z = 1
```