My Geeky Interests: Functional programming

A while ago I needed a Lexer and Yacc for .NET. Looking at the class-structure of Sitecore, I found out it was just another LR parsing algorithm. So I contacted Jakob and his first reply was:

Oh man, Alex, you just hit my pet, favorite, geeky interest – compilers.
The Sitecore Query language uses a hand written compiler.

[…]

I find that if you have a good tokenizer and an EBNF, it is fairly simple to write a compiler. I guess that is why it can be automated.

–Jakob

Well today S. Somasegar hit my geeky interest: functional programming! Actually it isn’t that far from compilers as compile algorithms can easily be written in functional languages such as Haskell and F#. I’ve worked with a Haskell-variant for a while, called Clean. Although I didn’t enjoyed it at that time, it is was an amazing learning method for me. I often hear that I’m really good at writing readable code(thank you for the compliments :)), I’ve learned that while writing functions in Clean…

Now back to the news and to start directly: F# becomes a full part of the .NET family, including full support in Visual Studio 2008(as add-on). There are already a lot of sites on the web about this amazing language:

I hardly can’t wait to write my collection classes and extensions in F#. It will be amazing fast and easy comparing it to the effort of time you’ve to spent these days on collections and ugly patterns such as ‘yield returns’. And what about lambda expressions? Using them everywhere in your code. Starting to think about it, can’t wait to program against Sitecore using F#. Larger data collections? So what! F# is, like any other programming language, used to work with infinite lists… One of the coolest aspects is as well that Microsoft can provide a functional programming language to schools and universities. This means that the door behind Haskell can finally be closed.
So clap your hands for Don Syme and all those other contributors to the project.

Definitely a related subject: Parallel programming. There’s a lot of stuff going on with PLINQ(Parallel Language Integrated Query) and Microsoft has also published a lot of information on their Parallel Framework Toolkit. For information, watch Joe Duffy’s blog, read the MSDNMag Okt2007 article on Multi-core optimizing or watch this video on Channel 9.

Gotta sleep now, or maybe setup a new blogpost :).