aboutsummaryrefslogtreecommitdiff
path: root/examples/fold.fco
blob: 44df43536a3d5ce3ee946b3f9fb01b7dff7fcb95 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
def op(acc x)
    if mod(x 2)
        +(acc x)
    else
        acc
    end
end

# add odd numbers from 0 to 1000
def main()
    display(fold(0 op ..(0 1000)))
end