Most of the new features of C# 3.0 open up a world of expressive functional programming to the C# programmer. Functional programming, in its pure form, is a programming methodology built on top of immutable variables (sometimes called symbols), functions that can produce other functions, and recursion, just to name a few of its foundations. Some prominent functional programming languages include Lisp, Haskell, F#,1 and Scheme.2 However, functional programming does not require a pure functional language and one can use and implement functional programming disciplines in traditionally imperative languages like the C-based languages (including C#). The new C# 3.0 features transform the language into a more expressive hybrid language where both imperative and functional programming techniques can be utilized in harmony. Lambda expressions are arguably the biggest piece of this functional programming pie.
KeywordsFunctional Programming Fibonacci Number Statement Block Expression Tree Parameter List
Unable to display preview. Download preview PDF.
- 1.F# is an exciting new functional programming language for the.NET Framework. For more information, I invite you to read Robert Pickering’s Foundations of F# (Berkeley, CA: Apress, 2007).Google Scholar
- 2.One of the languages that I use often is C++. Those of you who are familiar with metaprogramming in C++ are definitely familiar with functional programming techniques. If you use C++ and you’re curious about metaprogramming, I invite you to check out David Abrahams’ and Aleksey Gurtovoy’s excellent book C++ Template Metaprogramming: Concepts, Tools, and Techniques from Boost and Beyond (Boston, MA: Addison-Wesley Professional, 2005).Google Scholar