December 2005 Blog Posts

Forwards is the new backwards with the |> operator

Recently Don Syme made a post to the F# mailing list about some proposed changes to the F# libraries. In it talked about the virtues of using the new |> operator, sighting the following example as something it would be difficult without it:   let methods = System.AppDomain.CurrentDomain.GetAssemblies()             |> List.of_array |> List.map ( fun assm -> assm.GetTypes() ) |> Array.concat             |> List.of_array |> List.map ( fun t -> t.GetMethods() ) |> Array.concat   After squinting at it for a while I realised that I didn’t really understand what the sample was doing, let alone see the advantage...

Rico Mariani’s performance quiz 8 – Part 2 – The Great Parsers Shoot Out

Rico made some more interesting posts in his parser performance quiz, first producing a parser where the predicates are compiled into an in memory representation and also a parser where he produces IL on the fly. He talks about them here and here respectively.   So I ported both of these parsers to F#; as they demonstrate some nice uses of patterns commonly used in ML, such as take one data structure that is easy to read and transforming it into another than is easy to evaluate. This gives us 6 parsers in total, so...