Skip to content

Instantly share code, notes, and snippets.

@espio999
Last active July 7, 2024 23:34
Show Gist options
  • Save espio999/4bb03a54fc59a4733851225973fe0fc7 to your computer and use it in GitHub Desktop.
Save espio999/4bb03a54fc59a4733851225973fe0fc7 to your computer and use it in GitHub Desktop.
F# fibonacci, call memo.fsx and fibonacci.fsx
#load "memo.fsx"
#load "fibonacci.fsx"
open memo
open fibonacci
open System.Diagnostics
let memo_fib = memoize fib
let memo_fib_tail = memoize fib_tail_recursion
//let sw = new System.Diagnostics.Stopwatch()
let sw = new Stopwatch()
sw.Start()
memo_fib 45 |> printfn "%A"
sw.Stop()
sw.ToString() |> printfn "%s"
sw.Restart()
memo_fib_tail 45 |> printfn "%A"
sw.Stop()
sw.ToString() |> printfn "%s"
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment