Try F# in your browser
tryfs.net
tryfs.net
Ever wonder what the 200,000th Fibonacci number is? Last night with a recursive F# function I got it in FSI in just over 6 seconds. It would be cool if you could get this page to work well enough to do that.
In german though.
let root = "C:\\";
let getdirs dir =
try
System.IO.Directory.GetDirectories(dir)
with
| e -> Array.empty
let rec list_files dir = seq {
yield! System.IO.Directory.GetFiles(dir);
for subdir in (getdirs dir) do
match subdir with
| x when x.StartsWith("C:\\$") -> ()
| subdir -> yield! list_files subdir
}
list_files root
|> Seq.iter (printfn "%s")
printf "done"
All types inferred.I had to pad the first "let" to be at the same padding as the second one