Simple snippet that demonstrates recursively defined discriminated unions, the Y combinator (for encoding recursive functions) and recursive processing of tree-like structures
6 people like thisPosted: 13 years ago by Daniel Jackson
Domain model for the Tesco checkout implemented in F# using discriminated unions (in 20 lines of code) and console-based user interface for scanning products and calculating the total price.
5 people like thisPosted: 12 years ago by Tomas Petricek
Here I give an example of a data structure known as a skew binary list and also an example of how to use the cons pattern, normally reserved for FSharp lists, in your own union cases. It is not possible to do the same with the nil union case, []. Nor is it possible to use any other symbols (as far as I know). This kind of sucks.
2 people like thisPosted: 11 years ago by Greg Ros
A quick-and-dirty editor for discriminated unions in a property grid. I use this for editing trees of F# records and unions. Note that any records must have a "Default" static property which returns a default instance.
3 people like thisPosted: 12 years ago by Rick Minerich
A small snippet that groups sequences of arbitrary unions by branch type.
0 people like thisPosted: 11 years ago by Eirik Tsarpalis
Neat trick to improve safety
3 people like thisPosted: 2 years ago by Evgeniy Andreev