Skip to content

main.aug ​

List traversal benchmark · Source and specification

Files in this project

Code ​

aug
// aug-spec: "main.aug.md" explains this file. Read it before changes; refresh with aug spec.
int iterations = 100000
own List<int> values = []
int index = 0
while index < iterations:
    values.append(value=index * 3)
    index = index + 1
int checksum = 0
for value in values:
    checksum = checksum + value
print(value=checksum)
aug
// aug-spec: "main.aug.md" explains this file. Read it before changes; refresh with aug spec.
int iterations = 100000
own List<int> values = []
int index = 0
while index < iterations {
    values.append(value=index * 3)
    index = index + 1
}
int checksum = 0
for value in values {
    checksum = checksum + value
}
print(value=checksum)

Compiled specification ​

Interactions and sequences

Startup ​

It sets iterations to 100000. It stores a list with no items in owned values (List<int>). It sets index to 0. While index is less than iterations, it appends index times 3 to values; then it increases index by 1. source

After the loop, it sets checksum to 0. For each value in a snapshot of values, it increases checksum by value. After the loop, it prints checksum. source

Built-in operations follow the language reference.

Last updated:

The world runs on language