Using .map - vilinski/nemerle GitHub Wiki

Using .Map

  • Category: Functions - Arrays, Lists, Seqs
  • Description: .Map applies a given function to each element in the collection, returning a new collection.
  • Code:
using Nemerle;
using Nemerle.Collections;
using System;
using System.Console;

// can be applied to arrays and sequences as well
def data = [(1, 1, 2001), (2, 2, 2004), (6, 17, 2009)];
def aoList2 = data.Map((a, b, c) => DateTime(c, a, b).ToString());
foreach (i in aoList2) WriteLine(i)
  • Execution Result:
01.01.2001 0:00:00
02.02.2004 0:00:00
17.06.2009 0:00:00

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