Handy F# snippets

Posted by Benjol on Stack Overflow See other posts from Stack Overflow or by Benjol
Published on 2009-05-07T06:37:14Z Indexed on 2010/03/17 6:41 UTC
Read the original article Hit count: 441

Filed under:
|
|

There are already two questions about F#/functional snippets.

However what I'm looking for here are useful snippets, little 'helper' functions that are reusable. Or obscure but nifty patterns that you can never quite remember.

Something like:

open System.IO

let rec visitor dir filter= 
    seq { yield! Directory.GetFiles(dir, filter)
          for subdir in Directory.GetDirectories(dir) do 
              yield! visitor subdir filter}

I'd like to make this a kind of handy reference page. As such there will be no right answer, but hopefully lots of good ones.

© Stack Overflow or respective owner

Related posts about F#

Related posts about reference