Shameless plug - FsTest
Matthew Podwysocki finished putting together a DSL for unit testing. I imagine this only scratches the surface of what you can do with DSLs in F#.
The same approach also works for scripting too, check out this piece of Zen:
#light
open System.IO
// Returns all the files under a given folder
let rec filesUnder rootPath =
seq {
for file in Directory.GetFiles(rootPath) do
yield file
for dir in Directory.GetDirectories(rootPath) do
yield! filesUnder dir }
// Deletes all files
let deleteAll files = Seq.iter File.Delete files
// Notice just how flippin sweet type inference is...
// File.Delete : string -> unit
// Seq.iter : ('a -> unit) -> #seq<'a> -> unit
// deleteAll : #seq<string> -> unit
// The pipe-backwards operator allows you to get this to
// execute in the right order without parens around 'filesUnder'
deleteAll <| filesUnder @"C:\Logs"
Comments
Anonymous
June 22, 2008
PingBack from http://wordnew.acne-reveiw.info/?p=1698Anonymous
June 25, 2008
SWEET!!! I'm particularly envious of yield! - it's a shame we don't have that in C#: http://kirillosenkov.blogspot.com/2007/10/yield-foreach.html