Skip to content

Instantly share code, notes, and snippets.

@cocodrino
Created June 14, 2012 21:16
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save cocodrino/2933009 to your computer and use it in GitHub Desktop.
Save cocodrino/2933009 to your computer and use it in GitHub Desktop.
trying f#
let rec factorial(n : int) (mem : bigint) =
match n with
| 0 | 1 -> mem
| _ -> factorial (n - 1) (mem * bigint(n))
let BigFactorial(numero,mesaje)=
Async.FromContinuations(fun (cont,error,cancelation) ->
printfn "ha comenzado el proceso: %s" mesaje
factorial numero 1I |>ignore
printfn "ha terminado el proceso: %s ." mesaje
cont())
Async.RunSynchronously(async{
printfn "comenzando"
do! BigFactorial(100000,"100 mil")
do! BigFactorial(500, "500")
printfn "fin..."
})
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment