- 
                Notifications
    
You must be signed in to change notification settings  - Fork 90
 
Using Where
        CodingUnit edited this page Dec 28, 2011 
        ·
        3 revisions
      
    - Category: Functions - Arrays, Lists, Seqs
 - Description: .choose applies a given function to the collection, returning an array of results x where the function evaluates to Some(x).
 - Code:
 
using System;
using System.Console;
using Nemerle;
using System.Linq;
def numbers = Enumerable.Range(1, 20);
def evens = numbers.Where(x => x % 2 == 0);
WriteLine($"numbers = ..$numbers"); 
WriteLine($"evens = ..$evens" )- Execution Result:
 
numbers = 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20
evens = 2, 4, 6, 8, 10, 12, 14, 16, 18, 20