F# / C# - from Chris Smith's Blog on F# tutorial .....

F# Code

#light

let
square x = x * x

let numbers = [1 .. 10]

let squares = List.map square numbers

printfn "N^2 = %A"squares

open System

Console.ReadKey(true)


C# Code


using System;

using System.Linq;

class Program

{

static void Main()

{

Func square = x => x * x;

int[] numbers = { 1, 2, 3, 4, 5, 6, 7, 8, 9, 10 };

var squares = numbers.Select(square);

Console.WriteLine("N^2 = {0}", squares.Aggregate("", (s, i) => s + " " + i));

Console.ReadKey(true);

}

}


Comments

Popular posts from this blog

The specified initialization vector (IV) does not match the block size for this algorithm