Functional CSharp 0.5

Rating:        Based on 1 rating
Reviewed:  1 review
Downloads: 174
Released: Jan 13, 2010
Updated: Jan 18, 2010 by holoed
Dev status: Beta Help Icon

Recommended Download

Source Code FunctionalCSharp_src_0.5.zip
source code, 32K, uploaded Jan 13, 2010 - 133 downloads

Other Available Downloads

Application FunctionalCSharp_bin_0.5.zip
application, 61K, uploaded Jan 13, 2010 - 41 downloads

Release Notes

This is a beta release of the Functional C# Library.
  • Refactoring of Object Expressions, now more powerful than ever.
  • Added Tuples (using Object Expressions)
  • Added Active Patterns for Tuples
  • General refactorings.
  • Added more tests.

Tuples support

var xy = Tuple.New(42, "Hello");
var x = xy.Match()
              .Tuple((px, _) => px)
              .Return<int>();
var y = xy.Match()
               .Tuple((_, py) => py)
               .Return<string>();

Object Expressions

Used to create tuples.
public Tuple<T1,T2> CreateTuple<T1,T2>(T1 t1, T2 t2)
{
    return ObjectExpression
                .New<Tuple<T1, T2>>()
                .With(o => () => o.First, () => t1)
                .With(o => () => o.Second, () => t2)
                .Return();
}

Create a comparer implementation inline ;)
 var list = new SortedList<int, string>(
                ObjectExpression
                .New<IComparer<int>>()
                .With(o => o.Compare, (int x, int y) => x - y)
                .Return());

 list.Add(3, "l");
 list.Add(2, "e");
 list.Add(4, "l");
 list.Add(1, "H");
 list.Add(5, "o");

 Assert.AreEqual("Hello", list.Values.Aggregate((x, y) => x + y));        

Reviews for this release

     
Great Tool ! Since I was introduced to functional programming in PLT/Scheme, I've never been so much comfortable programming the functional way with this tool than ever before. I can have the expressiveness of F# alongside the power of C# all together !
by arcane_master on Sep 3, 2010 at 12:19 AM