Perl Style "Regex Matches?" operator
49 people like thisPosted: 13 years ago by fholm
F# necessarily forces you to explicitly cast between int and float for operations such as division. This is necessary because implicit conversion would make type inference much harder. However having to cast all the time in your code can be a pain. These operators reduce the overhead to one or at most two characters of code.
3 people like thisPosted: 12 years ago by Kit Eason
Useful for pinvoke stuff where your native API requires that you have a unmanaged buffer containing the data you want to work on. Edit: Changed native calls, removed Marshal.Copy (there is a async corner case but I won't delve into it here) and replaced with pinning.
5 people like thisPosted: 11 years ago by David Klein
Inspired by @theburningmonk, this snippet defines a couple of extensions and operators that can be used to make F# as short and as obscure as APL. Complete with a 19 character solution of the Euler problem #1!
7 people like thisPosted: 9 years ago by Tomas Petricek
Simple function to apply operators to option types. Applies the operator to each value and returns a new option containing the result. Treats None as the operator's identity element (i.e., ignores it).
1 people like thisPosted: 12 years ago by Richard Broida
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
Make the (!) operator even more useful by duck typing it. Simple and effective!
5 people like thisPosted: 10 years ago by Sami Perttu
A small set of operators for converting boolean expressions to an optional type on the principle of false -> None, true -> Some value.
0 people like thisPosted: 2 years ago by Pavel Tatarintsev