Using F# active patterns with LINQ expression trees

Luis Diego Fallas has written a nice blog entry on using F# active patterns to ease the process of working with LINQ expression trees. This kind of “meta-programming” application is absolutely one of the key reasons why Greg Neverov, James Margetson and myself added the feature to F#. I’m very glad to see Luis putting the pieces together and explaining what’s going on clearly.  Luis also has an earlier post explaining the basics of F# active patterns.

On related topics, I had a helpful chat with Phil Wadler on Wednesday, who pointed out some conceptual simplifications to make to how we explain and specify the active pattern mechanism. Phil started it all back in 1986!


Comments (2)

  1. New Mashup – Combining SharePoint List Data with Popfly RSS Blocks, LiveLocal and More F# Books, and

  2. Jon Harrop says:

    XML data in .NET’s DOM format can be handled very elegantly using active patterns.

    The active patterns use run-time type testing to determine which kind of XML node is under examination (e.g. Element or Text) and the resulting patterns can be used to dissect XML with an elegance not seen in any other language.

    The second F#.NET Journal article walks through this technique in detail, with complete code.