aboutsummaryrefslogtreecommitdiff
path: root/examples/fold.fco
blob: ea3f5e429fcb21caf6bee6ea3464d257ce9462ed (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 1 to 10
def main()
    display(fold(0 op list(1 2 3 4 5 6 7 8 9 10)))
end