views:

367

answers:

9

For example, in Java there is Functional Java and Higher-Order Java. Both essentially give a small API for manipulating higher-order, curried functions, and perhaps a few new data types (tuples, immutable lists).

+2  A: 

I think you want F#

Also, the more recent versions of C# have a lot of functional concepts included in the base langauge.

Joel Coehoorn
A: 

F#, there's a CTP release available from microsoft.

Chuck
+2  A: 

There may be such a library for C#, but you should probably consider just using F# http://research.microsoft.com/fsharp/fsharp.aspx and http://msdn.microsoft.com/en-us/fsharp/default.aspx.

Microsoft plans to make F# a first-class language in Visual Studio so there should be little risk in using one of the CTPs to build your initial stuff.

Grant Wagner
+1  A: 

If you're looking for something that extends C# then no, but there is F# which is a .NET based functional language. From the "About F#" page:

F# is a typed functional programming language for the .NET Framework. It combines the succinctness, expressivity, and compositionality of typed functional programming with the runtime support, libraries, interoperability, tools and object model of .NET. F# stems from the ML family of languages and has a core language compatible with that of OCaml, though also draws from C# and Haskell. F# was designed from the ground up to be a first-class citizen on .NET, giving smooth interoperability with other .NET languages. For example, C# and F# can call each other directly. This means that F# has immediate access to all the .NET Framework APIs, including, for example, Windows Presentation Foundation and DirectX. Similarly, libraries developed in F# may be used from other .NET languages.

Since F# and OCaml share a similar core language, some OCaml libraries and applications can cross-compile either directly or with minor conditionally-compiled changes. This provides a path to cross-compile and/or port existing OCaml code to .NET, and also allows programmers to transfer skills between these languages. A major focus of the project has been to extend the reach of OCaml-like languages into arenas where they have not traditionally been used. Throughout the project the designers of F# are grateful for the support and encouragement of Xavier Leroy and others in the OCaml community.

Scott Dorman
+5  A: 

have you looked into F#?

Also a neat blog post would be here that talks about how to use the new generic / lambda expressions built into c# 3.0.

If you just add using System.Linq to the top of your source file there are a LOT of nice new functions added to working with collections such as folding / filtering / etc.

Gord
+2  A: 

Not a shrink-wrapped library per se, but Luca Bolognese of Microsoft has a series of blog posts where he builds a C# library for functional programming with types like tuples, records, type unions and so on:

Also Linq is basically a library for functional programming with syntactial support in C#.

JacquesB
+2  A: 

Check out http://code.msdn.microsoft.com/FunctionalCSharp for some samples.

Vasu Balakrishnan
+2  A: 

Functional style pattern matching for C#

Monad library for C#/.Net

There is also 'elevate' which has some functional things like option types (maybes) etd:

Frep D-Oronge