Posted by: leppie | October 27, 2009

IronScheme and C# 4’s new dynamic keyword

So everyone (well all the IronXXX people) is doing it, so I might well too :)

I present using IronScheme in C# 4:

class Program
{
  static dynamic Scheme = new SchemeEnvironment();

  static void Main(string[] args)
  {
    var list = Scheme.list;
    var map = Scheme.map;
    var reverse = Scheme.reverse;

    Func<int, int> f = x => x * x;

    var r = map(f, reverse(map(f, list(1, 2, 3))));

    Console.WriteLine(r.car); // prints 81
  }
}

The implementation is straight forward, and can be viewed here. I just involves a simple Linq expression. :)

Cheers

leppie


Responses

  1. LOL @ “static dynamic”

    • I was thinking exactly the same when I wrote it.

  2. Something new about silverlight support?

    • Nope, sorry.


Leave a response

Your response:

Categories