When does F # make a permanent crease?

I just wrote some built-in maths utility functions and, while testing, noticed that

let quat = (3, 0, 0, 3)
(quat |||~||| quat)
|> ijk
|> printAn

      

completely collapses into printAn (18, 0, 0)

, and starting with (3.0f, 0.0f, 0.0f, 3.0f)

only inserts the original constant values 0.0f

and 3.0f

without evaluating any of the floating point operators and with some instance Tuple

(but not as much as in debug mode).

(I'm using Visual Studio 2013 Update 4 targeting framework 4.5 with default configuration Release

. Can't define a constant TRACE

, and it doesn't matter open Unchecked

.)


I'm not too worried about the performance implications as it is easy to collapse the expression through the IL plexus if it becomes a problem, but I am nonetheless interested in what the compiler can consistently dump.

+3


source to share





All Articles