

F# Versus Microsoft's Regex. A Lesson in Types - DanielBMarkham
http://www.whattofix.com/blog/archives/2010/07/f-versus-micros.php

======
fleitz
F# is one of the hidden jewels of the .NET platform, I really hope they give
it first class support like C# and VB.NET.

------
jrockway
Wow, F#'s backwards function composition is confusing!

~~~
fleitz
I didn't see the function composition operator in there, I saw a lot of use of
the pipe operator (|>), F# does have backwards function composition but it is
the << operator. Function composition is >>. You can also define new operators
or redefine operators in F#.

The annoying upshot of this is that bitwise operations in F# use three
character operators &&&, |||, ^^^, <<<, >>> which is weird coming from an
imperative background.

They use this feature for dynamic invocation on the DLR (.NET 4.0), so to
invoke foo() dynamically on bar you'd write bar?foo instead of bar.foo

Speaking of regexes and operators, if you're a fan of perl or ruby you can do
the following:

let (=~) text pattern = Regex.IsMatch(text,pattern)

or for maximum F# goodness

let (=~) text pattern = Regex.Matches(text,pattern) |> (fun matches -> match
matches.Length with 0 -> None | _ -> Some(matches))

