Monday, March 29, 2010

Hello F#

I just got my Release Candidate of Visual Studio 2010 up and running so I thought I'd do the obligatory recursive greeting function (not as pretty as Ruby or Python, but we're talking about F# here!)
let rec reverse (value : string) =
if value.Length < 2 then
value.Chars(value.Length - 1).ToString() + reverse(value.Substring(0, value.Length - 1))

let main (args) =
printfn "%s" (reverse("!dlroW ,olleH"))

No comments: