What simple, non-trivial, useful code you created in F #

I am trying to learn F #, but since I never did any functional programming or adopted a class in it, it is very difficult for me to generalize trivial examples of fibonacci or factorial in how I will do something useful.

So, what simple, but non-trivial non-trivial and useful F # code exists on the net?

+7
f #
source share
5 answers

I like to use it whenever I need parser support (currently you can call it DSL) and whenever I implement character processing algorithms.

The last productive code I wrote in F # concerned filters (used to filter incoming messages to the logging service). I have several basic filters (which handle the topic, etc.) And higher order logic filters that combine other filters with AND / OR / NOT statements. The implementation simplifies such โ€œexpressionsโ€ by converting them to CNF, collecting by type and using special rules (for example, <5 & a <10 => a <5, etc.). In addition to this, I create a simple parser with fsyacc to provide users of this service with an easier way to create filters.

I assume that a hole in F # has as many lines of code that I would need with C # to write just a simplification;)

+2
source share

Here's a great session from PDC - it makes a pretty non-trivial sample application.

+4
source share

There are many blogs with fun code samples; start at http://fsharp.net and follow various community blogs and samples to dig up some content.

+2
source share

I know this is not a direct answer, but my advice is: port the library from Haskell. You will receive an excellent, guaranteed functional code for reading and writing. It will make you different.

Examples: FParsec and FsCheck . Many candidates for Hacakge .

Alternatively, do the Real World Haskell book and try writing some of the examples in F #.

Lastly, browse codeplex and friends for things marked with F #.

0
source share
0
source share

All Articles