Will.Whim

A weblog by Will Fitzgerald

Monthly Archives: March 2011

F# no parameter functions

Notes to myself: F# version

*Whenever* writing or using a no parameter function, give it an empty parameter list.

  let long_running_function() =
    do_something_that_takes_a_long_time()

not:

 let long_running_function =
    do_something_that_takes_a_long_time

or

 let long_running_function =
    do_something_that_takes_a_long_time()

The last example will create a (global) non-function variable which evaluates to the result of the do_something function at load/compile time; probably not what is wanted.

Just wasted about 4 hours on this (since it was taking a long time, and consumed all the resources on my machine, it was difficulter to debug).

Idy Kiser

Idy Clare Kiser
Is a kind, wise advisor.
Pay attention. She takes her place
“Seventy-seven-on-the-top. The Child of Grace.”