I'm trying to learn F#, but since I have never done any functional programming or taken a class in it, I find it very hard to generalize the trivial fibonacci or factorial examples into how I would do something usable.
So, what simple but nontrivial non-trivial and usable F# code is there on the net?
Here is a great session from PDC -- he does a fairly non-trivial example application.
I like to use it whenever I have the need for parser support (nowadays you might call it DSL) and whenever I implement symbol-processing algorithms.
The latest productive code I've written in F# concerns filters (used to filter incomming messages to a logging service). I've got a couple of basic filters (that processes the subject, etc.) and higher-order logic filters that combine other filters with AND/OR/NOT operators. The implementation simplifies such "expressions" by converting them to CNF, collecting by type and using special rules (like a < 5 && a < 10 => a < 5, etc.) On top of this I createt a simple parser with fsyacc to give the users of this service a simpler way to create filters.
I guess the hole thing has in F# as many lines of code I would have needed with C# to write just the simplification ;)
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With