Lists and Filter - vilinski/nemerle GitHub Wiki

Lists and Filter

  • Category: Lists, Tuples and Options
  • Description: This sample shows how to filter a list
  • Code:
using Nemerle;
using Nemerle.Collections;
using System;
using System.Console;

def data = [("Cats", 4),
            ("Dogs", 5),
            ("Mice", 3),
            ("Elephants", 2)];
def res = data.Filter((nm, x) => nm.Length <= 4);
WriteLine($"Animals with short names: $res")
  • Execution Result:
Animals with short names: [(Cats, 4), (Dogs, 5), (Mice, 3)]

[Copyright ©](Terms of use, legal notice)