Skip to content
Rohan Singh edited this page Aug 22, 2014 · 5 revisions

Welcome to the Mond wiki!

seq range(start, end) {
    for (var i = start; i <= end; i++)
        yield i;
}

fun where(list, filter) -> [x : x in list, filter(x)];

fun select(list, transform) -> [transform(x) : x in list];

fun toArray(list) {
    var array = [];

    foreach (var value in list) {
        array.add(value);
    }

    return array;
}

return range(0, 1000)
       |> where(fun (x) -> x % 2 == 0)
       |> select(fun (x) -> x / 2)
       |> toArray();