<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	xmlns:wfw="http://wellformedweb.org/CommentAPI/"
	xmlns:dc="http://purl.org/dc/elements/1.1/"
	xmlns:atom="http://www.w3.org/2005/Atom"
	xmlns:sy="http://purl.org/rss/1.0/modules/syndication/"
	xmlns:slash="http://purl.org/rss/1.0/modules/slash/"
	>

<channel>
	<title>thinkhard</title>
	<atom:link href="http://blog.thinkhard.net/feed/" rel="self" type="application/rss+xml" />
	<link>http://blog.thinkhard.net</link>
	<description>assiduous investigations within discrete space and time</description>
	<lastBuildDate>Thu, 23 Jun 2011 01:51:21 +0000</lastBuildDate>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.2.1</generator>
		<item>
		<title>Creational Design Pattern: Lazy Initialization</title>
		<link>http://blog.thinkhard.net/2011/06/creational-design-pattern-lazy-initialization/</link>
		<comments>http://blog.thinkhard.net/2011/06/creational-design-pattern-lazy-initialization/#comments</comments>
		<pubDate>Thu, 23 Jun 2011 01:06:12 +0000</pubDate>
		<dc:creator>ninegrid ⋮⋮⋮</dc:creator>
				<category><![CDATA[Creational]]></category>
		<category><![CDATA[Design Pattern]]></category>
		<category><![CDATA[F#]]></category>

		<guid isPermaLink="false">http://blog.thinkhard.net/?p=61</guid>
		<description><![CDATA[Lazy initialization is a creational design pattern in which computing a value or instantiation of (an) object(s) is delayed until the first time it is needed. The purpose of this article is to demonstrate the implementation of a general Lazy Initialization pattern using the F# language. Although F# has built-in faculties for dealing with Lazy ]]></description>
			<content:encoded><![CDATA[<p>Lazy initialization is a creational design pattern in which computing a value or instantiation of (an) object(s) is delayed until the first time it is needed.  The purpose of this article is to demonstrate the implementation of a general Lazy Initialization pattern using the F# language.  Although F# has built-in faculties for dealing with Lazy Initialization it will be instructive if you are coming from a C# background to see how this can be implemented in the F# language.</p>
<p />
F# is not implicitly lazy, however it is worthwhile to note that the keyword &#8220;eager&#8221; is reserved for future use and I have no idea why.   As it is, right now, F# is eagerly evaluated and we have to tell the compiler to “be lazy here”.  With regard to explicit laziness we have a few approaches at our disposal.  Let’s start out with the core concepts and then work toward a solid implementation of Lazy Initialization.</p>
<p />
<h2>Goals:</h2>
<ol>
<li />Delay the binding of values
<li />Cache the results such that the computation is performed only once
</ol>
<p />
The correct implementation of Lazy Initialization consists of two primary goals; first, an expensive computation must be delayed until the value is actually needed to continue executing the program.  Second, the memoization of the result is needed so that additional requests for the value do not perform the computation again.<br />

<pre class="fssnip">
<span class="l">  1: </span><span class="c">//</span><span class="c"> </span><span class="c">Delay</span><span class="c"> </span><span class="c">with</span><span class="c"> </span><span class="c">unit.</span>
<span class="l">  2: </span><span class="k">type</span> <span class="i">ComplicatedObject</span> <span class="o">=</span> <span onmouseout="hideTip(event, 'fstips1', 1)" onmouseover="showTip(event, 'fstips1', 1)" class="i">System</span><span class="o">.</span><span onmouseout="hideTip(event, 'fstips2', 2)" onmouseover="showTip(event, 'fstips2', 2)" class="i">Object</span>
<span class="l">  3: </span><span class="k">let</span> <span onmouseout="hideTip(event, 'fstips3', 3)" onmouseover="showTip(event, 'fstips3', 3)" class="i">o</span>     <span class="o">=</span> <span class="k">new</span> <span onmouseout="hideTip(event, 'fstips4', 4)" onmouseover="showTip(event, 'fstips4', 4)" class="i">ComplicatedObject</span>() <span class="c">//</span><span class="c"> </span><span class="c">val</span><span class="c"> </span><span class="c">a</span><span class="c">  </span><span class="c">:</span><span class="c"> </span><span class="c">ComplicatedObject</span>
<span class="l">  4: </span><span class="k">let</span> <span onmouseout="hideTip(event, 'fstips5', 5)" onmouseover="showTip(event, 'fstips5', 5)" class="i">f</span>  () <span class="o">=</span> <span class="k">new</span> <span onmouseout="hideTip(event, 'fstips4', 6)" onmouseover="showTip(event, 'fstips4', 6)" class="i">ComplicatedObject</span>() <span class="c">//</span><span class="c"> </span><span class="c">val</span><span class="c"> </span><span class="c">a'</span><span class="c"> </span><span class="c">:</span><span class="c"> </span><span class="c">unit</span><span class="c"> </span><span class="c">-&gt;</span><span class="c"> </span><span class="c">ComplicatedObject</span>
</pre>
</p>
<p/>
In this example we are type aliasing <i>System.Object</i> to a type named <i>ComplexObject</i>, which saves me the hassle of creating anything complex for purposes of demonstration.  On line <b>3</b> a new instance of <i>ComplicatedObject</i> is created and immediately bound to the value <i>o</i>.  In line <b>4</b> we have created a <a href="http://blog.thinkhard.net/wp-content/plugins/wordpress-feed-statistics/feed-statistics.php?url=aHR0cDovL2VuLndpa2lwZWRpYS5vcmcvd2lraS9UaHVua18oZnVuY3Rpb25hbF9wcm9ncmFtbWluZyk=">thunk</a>, by defining a function, the type here happens to be:</p>
<p/>
\(unit \rightarrow ComplicatedObject\)</p>
<p/>
The <a href="http://blog.thinkhard.net/wp-content/plugins/wordpress-feed-statistics/feed-statistics.php?url=aHR0cDovL2VuLndpa2lwZWRpYS5vcmcvd2lraS9UaHVua18oZnVuY3Rpb25hbF9wcm9ncmFtbWluZyk=">thunk</a> is bound to the value <i>f</i>.  Line <b>4</b> is really all it takes to delay binding, which is the first requirement listed in the primary goals of Lazy Initialization.  A function like <i>f</i> used to delay the creation of <i>ComplicatedObjects</i>.  When we evaluate <i>f</i> with <i>unit</i>, we receive a new <i>ComplicatedObject</i> in return, which can then be bound to some other value.</p>
<p/>
Although we shouldn&#8217;t neglect the consequences of eager evaluation when considering what problems, other than the <i>*cough*</i> obvious performance cost of initializing <i>ComplicatedObject</i> entails.  Consider then, the following situation involving <a href="http://blog.thinkhard.net/wp-content/plugins/wordpress-feed-statistics/feed-statistics.php?url=aHR0cDovL2VuLndpa2lwZWRpYS5vcmcvd2lraS9TY2hyJUMzJUI2ZGluZ2Vy"s_cat\">Schrödinger&#8217;s Cat</a>:<br />

<pre class="fssnip">
<span class="l">  5: </span><span class="k">type</span> <span onmouseout="hideTip(event, 'fstips6', 7)" onmouseover="showTip(event, 'fstips6', 7)" class="i">Cat</span> <span class="o">=</span>
<span class="l">  6: </span>  | <span onmouseout="hideTip(event, 'fstips7', 8)" onmouseover="showTip(event, 'fstips7', 8)" class="i">Alive</span>
<span class="l">  7: </span>  | <span onmouseout="hideTip(event, 'fstips8', 9)" onmouseover="showTip(event, 'fstips8', 9)" class="i">Dead</span>
<span class="l">  8: </span>
<span class="l">  9: </span><span class="k">let</span> <span onmouseout="hideTip(event, 'fstips9', 10)" onmouseover="showTip(event, 'fstips9', 10)" class="i">whatsInTheBox</span> () <span class="o">=</span>
<span class="l"> 10: </span>  <span class="k">let</span> <span onmouseout="hideTip(event, 'fstips10', 11)" onmouseover="showTip(event, 'fstips10', 11)" class="i">aliveOrDead</span> <span class="o">=</span>
<span class="l"> 11: </span>    <span class="k">match</span> (<span class="k">new</span> <span onmouseout="hideTip(event, 'fstips1', 12)" onmouseover="showTip(event, 'fstips1', 12)" class="i">System</span><span class="o">.</span><span onmouseout="hideTip(event, 'fstips11', 13)" onmouseover="showTip(event, 'fstips11', 13)" class="i">Random</span>())<span class="o">.</span><span class="i">Next</span> <span class="n">2</span> <span class="k">with</span>
<span class="l"> 12: </span>    | <span class="n">0</span> <span class="k">-&gt;</span> <span onmouseout="hideTip(event, 'fstips7', 14)" onmouseover="showTip(event, 'fstips7', 14)" class="i">Alive</span>
<span class="l"> 13: </span>    | _ <span class="k">-&gt;</span> <span onmouseout="hideTip(event, 'fstips8', 15)" onmouseover="showTip(event, 'fstips8', 15)" class="i">Dead</span>
<span class="l"> 14: </span>  <span class="k">let</span> <span onmouseout="hideTip(event, 'fstips12', 16)" onmouseover="showTip(event, 'fstips12', 16)" class="i">alive</span> <span class="o">=</span> <span onmouseout="hideTip(event, 'fstips13', 17)" onmouseover="showTip(event, 'fstips13', 17)" class="i">printfn</span> <span class="s">&quot;</span><span class="s">A</span><span class="s"> </span><span class="s">happy</span><span class="s"> </span><span class="s">kitty</span><span class="s">&quot;</span>
<span class="l"> 15: </span>  <span class="k">let</span> <span onmouseout="hideTip(event, 'fstips14', 18)" onmouseover="showTip(event, 'fstips14', 18)" class="i">dead</span>  <span class="o">=</span> <span onmouseout="hideTip(event, 'fstips13', 19)" onmouseover="showTip(event, 'fstips13', 19)" class="i">printfn</span> <span class="s">&quot;</span><span class="s">A</span><span class="s"> </span><span class="s">dead</span><span class="s"> </span><span class="s">kitty</span><span class="s">.</span><span class="s">&quot;</span>
<span class="l"> 16: </span>  <span class="k">match</span> <span onmouseout="hideTip(event, 'fstips10', 20)" onmouseover="showTip(event, 'fstips10', 20)" class="i">aliveOrDead</span> <span class="k">with</span>
<span class="l"> 17: </span>  | <span onmouseout="hideTip(event, 'fstips7', 21)" onmouseover="showTip(event, 'fstips7', 21)" class="i">Alive</span> <span class="k">-&gt;</span> <span onmouseout="hideTip(event, 'fstips12', 22)" onmouseover="showTip(event, 'fstips12', 22)" class="i">alive</span>
<span class="l"> 18: </span>  | <span onmouseout="hideTip(event, 'fstips8', 23)" onmouseover="showTip(event, 'fstips8', 23)" class="i">Dead</span>  <span class="k">-&gt;</span> <span onmouseout="hideTip(event, 'fstips14', 24)" onmouseover="showTip(event, 'fstips14', 24)" class="i">dead</span>
<span class="l"> 19: </span>
<span class="l"> 20: </span><span onmouseout="hideTip(event, 'fstips9', 25)" onmouseover="showTip(event, 'fstips9', 25)" class="i">whatsInTheBox</span> ()
</pre>
</p>
<p/>
Now, when we ask <i>whatsInTheBox ()</i> we find that our side effects are in the not-so-<a href="http://blog.thinkhard.net/wp-content/plugins/wordpress-feed-statistics/feed-statistics.php?url=aHR0cDovL2VuLndpa2lwZWRpYS5vcmcvd2lraS9TdXBlcnBvc2l0aW9uX3ByaW5jaXBsZQ==">super position</a> of being eagerly bound to the values <i>alive <b>:</b> unit</i> and <i>dead <b>:</b> unit</i>.<br />
<i><br />
	A happy kitty.<br />
	A dead kitty.<br />
	val it : unit = ()<br />
</i></p>
<p/>
So we use the technique on line <b>4</b> to instead create thunks to <i>printfn</i>.  Since we&#8217;re really going to be opening the box this time we&#8217;ll also return the <i>Cat</i> to the caller.<br />

<pre class="fssnip">
<span class="l"> 21: </span><span class="k">let</span> <span onmouseout="hideTip(event, 'fstips15', 26)" onmouseover="showTip(event, 'fstips15', 26)" class="i">openTheBox</span> () <span class="o">=</span>
<span class="l"> 22: </span>  <span class="k">let</span> <span onmouseout="hideTip(event, 'fstips10', 27)" onmouseover="showTip(event, 'fstips10', 27)" class="i">aliveOrDead</span> <span class="o">=</span>
<span class="l"> 23: </span>    <span class="k">match</span> (<span class="k">new</span> <span onmouseout="hideTip(event, 'fstips1', 28)" onmouseover="showTip(event, 'fstips1', 28)" class="i">System</span><span class="o">.</span><span onmouseout="hideTip(event, 'fstips11', 29)" onmouseover="showTip(event, 'fstips11', 29)" class="i">Random</span>())<span class="o">.</span><span class="i">Next</span> <span class="n">2</span> <span class="k">with</span>
<span class="l"> 24: </span>    | <span class="n">0</span> <span class="k">-&gt;</span> <span onmouseout="hideTip(event, 'fstips7', 30)" onmouseover="showTip(event, 'fstips7', 30)" class="i">Alive</span>
<span class="l"> 25: </span>    | _ <span class="k">-&gt;</span> <span onmouseout="hideTip(event, 'fstips8', 31)" onmouseover="showTip(event, 'fstips8', 31)" class="i">Dead</span>
<span class="l"> 26: </span>  <span class="k">let</span> <span onmouseout="hideTip(event, 'fstips16', 32)" onmouseover="showTip(event, 'fstips16', 32)" class="i">alive</span> <span class="o">=</span> <span class="k">fun</span> () <span class="k">-&gt;</span> <span onmouseout="hideTip(event, 'fstips13', 33)" onmouseover="showTip(event, 'fstips13', 33)" class="i">printfn</span> <span class="s">&quot;</span><span class="s">A</span><span class="s"> </span><span class="s">happy</span><span class="s"> </span><span class="s">kitty</span><span class="s">.</span><span class="s">&quot;</span>
<span class="l"> 27: </span>  <span class="k">let</span> <span onmouseout="hideTip(event, 'fstips17', 34)" onmouseover="showTip(event, 'fstips17', 34)" class="i">dead</span>  <span class="o">=</span> <span class="k">fun</span> () <span class="k">-&gt;</span> <span onmouseout="hideTip(event, 'fstips13', 35)" onmouseover="showTip(event, 'fstips13', 35)" class="i">printfn</span> <span class="s">&quot;</span><span class="s">A</span><span class="s"> </span><span class="s">dead</span><span class="s"> </span><span class="s">kitty</span><span class="s">.</span><span class="s">&quot;</span>
<span class="l"> 28: </span>  <span class="k">match</span> <span onmouseout="hideTip(event, 'fstips10', 36)" onmouseover="showTip(event, 'fstips10', 36)" class="i">aliveOrDead</span> <span class="k">with</span>
<span class="l"> 29: </span>  | <span onmouseout="hideTip(event, 'fstips7', 37)" onmouseover="showTip(event, 'fstips7', 37)" class="i">Alive</span> <span class="k">-&gt;</span> <span onmouseout="hideTip(event, 'fstips16', 38)" onmouseover="showTip(event, 'fstips16', 38)" class="i">alive</span>
<span class="l"> 30: </span>  | <span onmouseout="hideTip(event, 'fstips8', 39)" onmouseover="showTip(event, 'fstips8', 39)" class="i">Dead</span>  <span class="k">-&gt;</span> <span onmouseout="hideTip(event, 'fstips17', 40)" onmouseover="showTip(event, 'fstips17', 40)" class="i">dead</span>
<span class="l"> 31: </span>
<span class="l"> 32: </span><span onmouseout="hideTip(event, 'fstips15', 41)" onmouseover="showTip(event, 'fstips15', 41)" class="i">openTheBox</span> ()
</pre>
</p>
<p/>
This behaves as intended, delaying the call to <i>printfn</i> until it is absolutely necessary.  I&#8217;ve used a different syntax for lines <b>26</b> and <b>27</b> from line <b>4</b>.  Declarations such as: <i>let f () = ()</i> and <i>let f = fun () -> ()</i> are <a href="http://blog.thinkhard.net/wp-content/plugins/wordpress-feed-statistics/feed-statistics.php?url=aHR0cDovL2VuLndpa2lwZWRpYS5vcmcvd2lraS9Jc29tb3JwaGlj">structurally identical</a>.  Deciding which syntax to use and where is a <a href="http://blog.thinkhard.net/wp-content/plugins/wordpress-feed-statistics/feed-statistics.php?url=aHR0cDovL2VuLndpa2lwZWRpYS5vcmcvd2lraS9MaV8oQ29uZnVjaWFuKQ==">li</a>.<br />
<i><br />
A happy kitty.<br />
val it : SchrodingersCat = Alive<br />
</i></p>
<p/>
In practice, the technique we&#8217;re using here is a bit cumbersome.  If you had many types for which you needed to delay construction, you would have to wrap each of their default constructors in functions with different names.  Or even a type with many properties whos construction is delayed until they are first accessed could potentially cause us to write a lot of repetitive code.  Since F# treats functions as values we can create some higher order generalizations of delay:<br />

<pre class="fssnip">
<span class="l"> 33: </span><span class="c">//</span><span class="c"> </span><span class="c">Generalizing</span><span class="c"> </span><span class="c">delay.</span>
<span class="l"> 34: </span><span class="k">let</span> <span onmouseout="hideTip(event, 'fstips18', 42)" onmouseover="showTip(event, 'fstips18', 42)" class="i">delay</span>    <span onmouseout="hideTip(event, 'fstips19', 43)" onmouseover="showTip(event, 'fstips19', 43)" class="i">x</span> ()       <span class="o">=</span> <span onmouseout="hideTip(event, 'fstips19', 44)" onmouseover="showTip(event, 'fstips19', 44)" class="i">x</span> <span class="c">//</span><span class="c"> </span><span class="c">val</span><span class="c"> </span><span class="c">delay</span><span class="c">    </span><span class="c">:</span><span class="c"> </span><span class="c">'a</span><span class="c"> </span><span class="c">-&gt;</span><span class="c"> </span><span class="c">unit</span><span class="c"> </span><span class="c">-&gt;</span><span class="c"> </span><span class="c">'a</span>
<span class="l"> 35: </span><span class="k">let</span> <span onmouseout="hideTip(event, 'fstips20', 45)" onmouseover="showTip(event, 'fstips20', 45)" class="i">delayf</span>   <span onmouseout="hideTip(event, 'fstips21', 46)" onmouseover="showTip(event, 'fstips21', 46)" class="i">f</span> <span onmouseout="hideTip(event, 'fstips19', 47)" onmouseover="showTip(event, 'fstips19', 47)" class="i">x</span> ()     <span class="o">=</span> <span onmouseout="hideTip(event, 'fstips21', 48)" onmouseover="showTip(event, 'fstips21', 48)" class="i">f</span> <span onmouseout="hideTip(event, 'fstips19', 49)" onmouseover="showTip(event, 'fstips19', 49)" class="i">x</span>
<span class="l"> 36: </span><span class="k">let</span> <span onmouseout="hideTip(event, 'fstips22', 50)" onmouseover="showTip(event, 'fstips22', 50)" class="i">delayAny</span> <span onmouseout="hideTip(event, 'fstips19', 51)" onmouseover="showTip(event, 'fstips19', 51)" class="i">x</span> (_ <span class="o">:</span> <span class="o">'</span><span class="i">b</span>) <span class="o">=</span> <span onmouseout="hideTip(event, 'fstips19', 52)" onmouseover="showTip(event, 'fstips19', 52)" class="i">x</span> <span class="c">//</span><span class="c"> </span><span class="c">val</span><span class="c"> </span><span class="c">delayAny</span><span class="c"> </span><span class="c">:</span><span class="c"> </span><span class="c">'a</span><span class="c"> </span><span class="c">-&gt;</span><span class="c">  </span><span class="c">'b</span><span class="c">  </span><span class="c">-&gt;</span><span class="c"> </span><span class="c">'a</span>
<span class="l"> 37: </span><span class="k">let</span> <span onmouseout="hideTip(event, 'fstips23', 53)" onmouseover="showTip(event, 'fstips23', 53)" class="i">delayNew</span><span class="o">&lt;</span><span class="o">'</span><span class="i">a</span> <span class="k">when</span> <span class="o">'</span><span class="i">a</span> <span class="o">:</span> (<span class="k">new</span> <span class="o">:</span> <span onmouseout="hideTip(event, 'fstips24', 54)" onmouseover="showTip(event, 'fstips24', 54)" class="i">unit</span> <span class="k">-&gt;</span> <span class="o">'</span><span class="i">a</span>)<span class="o">&gt;</span> () <span class="o">=</span> <span class="k">new</span> <span class="o">'</span><span class="i">a</span>()
<span class="l"> 38: </span>
<span class="l"> 39: </span><span onmouseout="hideTip(event, 'fstips23', 55)" onmouseover="showTip(event, 'fstips23', 55)" class="i">delayNew</span><span class="o">&lt;</span><span onmouseout="hideTip(event, 'fstips4', 56)" onmouseover="showTip(event, 'fstips4', 56)" class="i">ComplicatedObject</span><span class="o">&gt;</span>     <span class="c">//</span><span class="c"> </span><span class="c">val</span><span class="c"> </span><span class="c">it</span><span class="c"> </span><span class="c">:</span><span class="c"> </span><span class="c">(unit</span><span class="c"> </span><span class="c">-&gt;</span><span class="c"> </span><span class="c">ComplicatedObject)</span>
<span class="l"> 40: </span><span onmouseout="hideTip(event, 'fstips23', 57)" onmouseover="showTip(event, 'fstips23', 57)" class="i">delayNew</span><span class="o">&lt;</span><span onmouseout="hideTip(event, 'fstips4', 58)" onmouseover="showTip(event, 'fstips4', 58)" class="i">ComplicatedObject</span><span class="o">&gt;</span> ()  <span class="c">//</span><span class="c"> </span><span class="c">val</span><span class="c"> </span><span class="c">it</span><span class="c"> </span><span class="c">:</span><span class="c"> </span><span class="c">ComplicatedObject</span>
</pre>
</p>
<p/>
We&#8217;ve accomplished our first goal of understanding how to delay values in F#, but what about the second?   In order to cache the result of computations we will need a type to represent the kinds of results a computation may result in.  I&#8217;ll use the word Idle as a synonym for Lazy so as to not conflict with the built-in lazy syntax in F#.   First of all the result of the computation can either be currently delayed, already cached, or some exceptional case.  We can use a <a href="http://blog.thinkhard.net/wp-content/plugins/wordpress-feed-statistics/feed-statistics.php?url=aHR0cDovL2VuLndpa2lwZWRpYS5vcmcvd2lraS9UYWdnZWRfdW5pb24=">Discriminated Union</a> to express that.<br />

<pre class="fssnip">
<span class="l"> 41: </span><span class="c">//</span><span class="c"> </span><span class="c">our</span><span class="c"> </span><span class="c">own</span><span class="c"> </span><span class="c">lazy</span><span class="c"> </span><span class="c">type</span><span class="c"> </span><span class="c">implementation</span>
<span class="l"> 42: </span><span class="k">type</span> <span onmouseout="hideTip(event, 'fstips25', 59)" onmouseover="showTip(event, 'fstips25', 59)" class="i">IdleState</span><span class="o">&lt;</span><span class="o">'</span><span class="i">a</span><span class="o">&gt;</span> <span class="o">=</span>
<span class="l"> 43: </span>  | <span onmouseout="hideTip(event, 'fstips26', 60)" onmouseover="showTip(event, 'fstips26', 60)" class="i">Delayed</span>   <span class="k">of</span> (<span onmouseout="hideTip(event, 'fstips24', 61)" onmouseover="showTip(event, 'fstips24', 61)" class="i">unit</span> <span class="k">-&gt;</span> <span class="o">'</span><span class="i">a</span>)
<span class="l"> 44: </span>  | <span onmouseout="hideTip(event, 'fstips27', 62)" onmouseover="showTip(event, 'fstips27', 62)" class="i">Cached</span>    <span class="k">of</span> <span class="o">'</span><span class="i">a</span>
<span class="l"> 45: </span>  | <span onmouseout="hideTip(event, 'fstips28', 63)" onmouseover="showTip(event, 'fstips28', 63)" class="i">Exception</span> <span class="k">of</span> <span onmouseout="hideTip(event, 'fstips1', 64)" onmouseover="showTip(event, 'fstips1', 64)" class="i">System</span><span class="o">.</span><span onmouseout="hideTip(event, 'fstips29', 65)" onmouseover="showTip(event, 'fstips29', 65)" class="i">Exception</span></pre>
</p>
<p/>
Now we will construct an <i>Idle<'a></i> type to encapsulate and mutate <i>IdleState<'a></i>.  We will need a static member to create instances of <i>Idle</i>, a property that tells us if the delayed value has already been computed, and finally a way to force the computed value.  We can use a mutable record type augmented with the appropriate members to pull this off.  However, with mutability there creeps in the hidden danger of shared state.  We&#8217;ll get around that easily in F# using the built-in <a href="http://blog.thinkhard.net/wp-content/plugins/wordpress-feed-statistics/feed-statistics.php?url=aHR0cDovL21zZG4ubWljcm9zb2Z0LmNvbS9lbi11cy9saWJyYXJ5L2VlMzcwNDEzLmFzcHg=">lock function</a>.<br />

<pre class="fssnip">
<span class="l"> 47: </span><span class="k">type</span> <span onmouseout="hideTip(event, 'fstips30', 66)" onmouseover="showTip(event, 'fstips30', 66)" class="i">Idle</span><span class="o">&lt;</span><span class="o">'</span><span class="i">a</span><span class="o">&gt;</span> <span class="o">=</span> 
<span class="l"> 48: </span>  { <span class="k">mutable</span> <span onmouseout="hideTip(event, 'fstips31', 67)" onmouseover="showTip(event, 'fstips31', 67)" class="i">status</span> <span class="o">:</span> <span onmouseout="hideTip(event, 'fstips25', 68)" onmouseover="showTip(event, 'fstips25', 68)" class="i">IdleState</span><span class="o">&lt;</span><span class="o">'</span><span class="i">a</span><span class="o">&gt;</span> }
<span class="l"> 49: </span>  <span class="k">static</span> <span class="k">member</span> <span onmouseout="hideTip(event, 'fstips32', 69)" onmouseover="showTip(event, 'fstips32', 69)" class="i">Create</span> <span onmouseout="hideTip(event, 'fstips33', 70)" onmouseover="showTip(event, 'fstips33', 70)" class="i">f</span> <span class="o">=</span> 
<span class="l"> 50: </span>    {<span class="i">status</span> <span class="o">=</span> (<span onmouseout="hideTip(event, 'fstips26', 71)" onmouseover="showTip(event, 'fstips26', 71)" class="i">Delayed</span> (<span onmouseout="hideTip(event, 'fstips33', 72)" onmouseover="showTip(event, 'fstips33', 72)" class="i">f</span>))}
<span class="l"> 51: </span>  <span class="k">member</span> <span onmouseout="hideTip(event, 'fstips34', 73)" onmouseover="showTip(event, 'fstips34', 73)" class="i">x</span><span class="o">.</span><span onmouseout="hideTip(event, 'fstips35', 74)" onmouseover="showTip(event, 'fstips35', 74)" class="i">IsValueCreated</span> 
<span class="l"> 52: </span>    <span class="k">with</span> <span class="i">get</span>() <span class="o">=</span>
<span class="l"> 53: </span>      <span onmouseout="hideTip(event, 'fstips36', 75)" onmouseover="showTip(event, 'fstips36', 75)" class="i">lock</span> <span onmouseout="hideTip(event, 'fstips34', 76)" onmouseover="showTip(event, 'fstips34', 76)" class="i">x</span><span class="o">.</span><span onmouseout="hideTip(event, 'fstips31', 77)" onmouseover="showTip(event, 'fstips31', 77)" class="i">status</span> (<span onmouseout="hideTip(event, 'fstips18', 78)" onmouseover="showTip(event, 'fstips18', 78)" class="i">delay</span> <span class="o">&lt;|</span>
<span class="l"> 54: </span>        <span class="k">match</span> <span onmouseout="hideTip(event, 'fstips34', 79)" onmouseover="showTip(event, 'fstips34', 79)" class="i">x</span><span class="o">.</span><span onmouseout="hideTip(event, 'fstips31', 80)" onmouseover="showTip(event, 'fstips31', 80)" class="i">status</span> <span class="k">with</span> 
<span class="l"> 55: </span>        | <span onmouseout="hideTip(event, 'fstips27', 81)" onmouseover="showTip(event, 'fstips27', 81)" class="i">Cached</span> _  <span class="k">-&gt;</span> <span class="k">true</span> 
<span class="l"> 56: </span>        | _         <span class="k">-&gt;</span> <span class="k">false</span>)
<span class="l"> 57: </span>  <span class="k">member</span> <span onmouseout="hideTip(event, 'fstips34', 82)" onmouseover="showTip(event, 'fstips34', 82)" class="i">x</span><span class="o">.</span><span onmouseout="hideTip(event, 'fstips37', 83)" onmouseover="showTip(event, 'fstips37', 83)" class="i">Force</span> () <span class="o">=</span> 
<span class="l"> 58: </span>    <span onmouseout="hideTip(event, 'fstips36', 84)" onmouseover="showTip(event, 'fstips36', 84)" class="i">lock</span> <span onmouseout="hideTip(event, 'fstips34', 85)" onmouseover="showTip(event, 'fstips34', 85)" class="i">x</span><span class="o">.</span><span onmouseout="hideTip(event, 'fstips31', 86)" onmouseover="showTip(event, 'fstips31', 86)" class="i">status</span> (<span onmouseout="hideTip(event, 'fstips18', 87)" onmouseover="showTip(event, 'fstips18', 87)" class="i">delay</span> <span class="o">&lt;|</span>
<span class="l"> 59: </span>      <span class="k">match</span> <span onmouseout="hideTip(event, 'fstips34', 88)" onmouseover="showTip(event, 'fstips34', 88)" class="i">x</span><span class="o">.</span><span onmouseout="hideTip(event, 'fstips31', 89)" onmouseover="showTip(event, 'fstips31', 89)" class="i">status</span> <span class="k">with</span>
<span class="l"> 60: </span>      | <span onmouseout="hideTip(event, 'fstips27', 90)" onmouseover="showTip(event, 'fstips27', 90)" class="i">Cached</span>    <span onmouseout="hideTip(event, 'fstips38', 91)" onmouseover="showTip(event, 'fstips38', 91)" class="i">v</span> <span class="k">-&gt;</span> <span onmouseout="hideTip(event, 'fstips38', 92)" onmouseover="showTip(event, 'fstips38', 92)" class="i">v</span>
<span class="l"> 61: </span>      | <span onmouseout="hideTip(event, 'fstips26', 93)" onmouseover="showTip(event, 'fstips26', 93)" class="i">Delayed</span>   <span onmouseout="hideTip(event, 'fstips33', 94)" onmouseover="showTip(event, 'fstips33', 94)" class="i">f</span> <span class="k">-&gt;</span> <span class="k">try</span> 
<span class="l"> 62: </span>                         <span class="k">let</span> <span onmouseout="hideTip(event, 'fstips38', 95)" onmouseover="showTip(event, 'fstips38', 95)" class="i">v</span> <span class="o">=</span> <span onmouseout="hideTip(event, 'fstips33', 96)" onmouseover="showTip(event, 'fstips33', 96)" class="i">f</span> () <span class="k">in</span> 
<span class="l"> 63: </span>                         <span onmouseout="hideTip(event, 'fstips34', 97)" onmouseover="showTip(event, 'fstips34', 97)" class="i">x</span><span class="o">.</span><span onmouseout="hideTip(event, 'fstips31', 98)" onmouseover="showTip(event, 'fstips31', 98)" class="i">status</span> <span class="o">&lt;-</span> (<span onmouseout="hideTip(event, 'fstips27', 99)" onmouseover="showTip(event, 'fstips27', 99)" class="i">Cached</span>(<span onmouseout="hideTip(event, 'fstips38', 100)" onmouseover="showTip(event, 'fstips38', 100)" class="i">v</span>))
<span class="l"> 64: </span>                         <span onmouseout="hideTip(event, 'fstips38', 101)" onmouseover="showTip(event, 'fstips38', 101)" class="i">v</span>
<span class="l"> 65: </span>                       <span class="k">with</span> <span onmouseout="hideTip(event, 'fstips39', 102)" onmouseover="showTip(event, 'fstips39', 102)" class="i">e</span> <span class="k">-&gt;</span> 
<span class="l"> 66: </span>                         <span onmouseout="hideTip(event, 'fstips34', 103)" onmouseover="showTip(event, 'fstips34', 103)" class="i">x</span><span class="o">.</span><span onmouseout="hideTip(event, 'fstips31', 104)" onmouseover="showTip(event, 'fstips31', 104)" class="i">status</span> <span class="o">&lt;-</span> <span onmouseout="hideTip(event, 'fstips28', 105)" onmouseover="showTip(event, 'fstips28', 105)" class="i">Exception</span>(<span onmouseout="hideTip(event, 'fstips40', 106)" onmouseover="showTip(event, 'fstips40', 106)" class="i">e</span>)
<span class="l"> 67: </span>                         <span onmouseout="hideTip(event, 'fstips41', 107)" onmouseover="showTip(event, 'fstips41', 107)" class="i">reraise</span>()
<span class="l"> 68: </span>      | <span onmouseout="hideTip(event, 'fstips28', 108)" onmouseover="showTip(event, 'fstips28', 108)" class="i">Exception</span> <span onmouseout="hideTip(event, 'fstips42', 109)" onmouseover="showTip(event, 'fstips42', 109)" class="i">e</span> <span class="k">-&gt;</span> <span onmouseout="hideTip(event, 'fstips43', 110)" onmouseover="showTip(event, 'fstips43', 110)" class="i">raise</span> <span onmouseout="hideTip(event, 'fstips42', 111)" onmouseover="showTip(event, 'fstips42', 111)" class="i">e</span>)
<span class="l"> 69: </span>  <span class="k">member</span> <span onmouseout="hideTip(event, 'fstips34', 112)" onmouseover="showTip(event, 'fstips34', 112)" class="i">x</span><span class="o">.</span><span onmouseout="hideTip(event, 'fstips44', 113)" onmouseover="showTip(event, 'fstips44', 113)" class="i">Value</span> 
<span class="l"> 70: </span>    <span class="k">with</span> <span class="i">get</span>() <span class="o">=</span> <span onmouseout="hideTip(event, 'fstips34', 114)" onmouseover="showTip(event, 'fstips34', 114)" class="i">x</span><span class="o">.</span><span onmouseout="hideTip(event, 'fstips45', 115)" onmouseover="showTip(event, 'fstips45', 115)" class="i">Force</span> ()
<span class="l"> 71: </span>
<span class="l"> 72: </span><span class="k">module</span> <span onmouseout="hideTip(event, 'fstips30', 116)" onmouseover="showTip(event, 'fstips30', 116)" class="i">Idle</span> <span class="o">=</span>
<span class="l"> 73: </span>  <span class="k">let</span> <span onmouseout="hideTip(event, 'fstips46', 117)" onmouseover="showTip(event, 'fstips46', 117)" class="i">create</span>  (<span onmouseout="hideTip(event, 'fstips33', 118)" onmouseover="showTip(event, 'fstips33', 118)" class="i">f</span> <span class="o">:</span> <span onmouseout="hideTip(event, 'fstips24', 119)" onmouseover="showTip(event, 'fstips24', 119)" class="i">unit</span> <span class="k">-&gt;</span> <span class="o">'</span><span class="i">a</span>) <span class="o">=</span> <span onmouseout="hideTip(event, 'fstips30', 120)" onmouseover="showTip(event, 'fstips30', 120)" class="i">Idle</span><span class="o">.</span><span onmouseout="hideTip(event, 'fstips47', 121)" onmouseover="showTip(event, 'fstips47', 121)" class="i">Create</span>(<span onmouseout="hideTip(event, 'fstips33', 122)" onmouseover="showTip(event, 'fstips33', 122)" class="i">f</span>)
<span class="l"> 74: </span>  <span class="k">let</span> <span onmouseout="hideTip(event, 'fstips48', 123)" onmouseover="showTip(event, 'fstips48', 123)" class="i">force</span>   (<span onmouseout="hideTip(event, 'fstips34', 124)" onmouseover="showTip(event, 'fstips34', 124)" class="i">x</span> <span class="o">:</span> <span onmouseout="hideTip(event, 'fstips30', 125)" onmouseover="showTip(event, 'fstips30', 125)" class="i">Idle</span><span class="o">&lt;</span><span class="o">'</span><span class="i">a</span><span class="o">&gt;</span>)   <span class="o">=</span> <span onmouseout="hideTip(event, 'fstips34', 126)" onmouseover="showTip(event, 'fstips34', 126)" class="i">x</span><span class="o">.</span><span onmouseout="hideTip(event, 'fstips44', 127)" onmouseover="showTip(event, 'fstips44', 127)" class="i">Value</span></pre>
</p>
<p/>
Here is how we would go about using our <i>Idle</i> type.  First I define the <a href="http://blog.thinkhard.net/wp-content/plugins/wordpress-feed-statistics/feed-statistics.php?url=aHR0cDovL21hdGh3b3JsZC53b2xmcmFtLmNvbS9BY2tlcm1hbm5GdW5jdGlvbi5odG1s">ackerman function</a>, something that should eat up a few cycles so we can see the difference between creating the delayed computation and forcing it to be computed.<br />

<pre class="fssnip">
<span class="l"> 75: </span><span class="c">//</span><span class="c"> </span><span class="c">a</span><span class="c"> </span><span class="c">vicious</span><span class="c"> </span><span class="c">recursive</span><span class="c"> </span><span class="c">function</span>
<span class="l"> 76: </span><span class="k">let</span> <span class="k">rec</span> <span onmouseout="hideTip(event, 'fstips49', 128)" onmouseover="showTip(event, 'fstips49', 128)" class="i">ackerman</span> <span class="o">=</span> <span class="k">function</span>
<span class="l"> 77: </span>  | (<span onmouseout="hideTip(event, 'fstips50', 129)" onmouseover="showTip(event, 'fstips50', 129)" class="i">m</span>,<span onmouseout="hideTip(event, 'fstips51', 130)" onmouseover="showTip(event, 'fstips51', 130)" class="i">n</span>) <span class="k">when</span> <span onmouseout="hideTip(event, 'fstips50', 131)" onmouseover="showTip(event, 'fstips50', 131)" class="i">m</span> <span class="o">=</span> <span class="n">0I</span> <span class="k">-&gt;</span> <span onmouseout="hideTip(event, 'fstips51', 132)" onmouseover="showTip(event, 'fstips51', 132)" class="i">n</span> <span class="o">+</span> <span class="n">1I</span>
<span class="l"> 78: </span>  | (<span onmouseout="hideTip(event, 'fstips50', 133)" onmouseover="showTip(event, 'fstips50', 133)" class="i">m</span>,<span onmouseout="hideTip(event, 'fstips51', 134)" onmouseover="showTip(event, 'fstips51', 134)" class="i">n</span>) <span class="k">when</span> <span onmouseout="hideTip(event, 'fstips51', 135)" onmouseover="showTip(event, 'fstips51', 135)" class="i">n</span> <span class="o">=</span> <span class="n">0I</span> <span class="k">-&gt;</span> <span onmouseout="hideTip(event, 'fstips49', 136)" onmouseover="showTip(event, 'fstips49', 136)" class="i">ackerman</span> (<span onmouseout="hideTip(event, 'fstips50', 137)" onmouseover="showTip(event, 'fstips50', 137)" class="i">m</span> <span class="o">-</span> <span class="n">1I</span>, <span class="n">1I</span>)
<span class="l"> 79: </span>  | (<span onmouseout="hideTip(event, 'fstips50', 138)" onmouseover="showTip(event, 'fstips50', 138)" class="i">m</span>,<span onmouseout="hideTip(event, 'fstips51', 139)" onmouseover="showTip(event, 'fstips51', 139)" class="i">n</span>)             <span class="k">-&gt;</span> <span onmouseout="hideTip(event, 'fstips49', 140)" onmouseover="showTip(event, 'fstips49', 140)" class="i">ackerman</span> (<span onmouseout="hideTip(event, 'fstips50', 141)" onmouseover="showTip(event, 'fstips50', 141)" class="i">m</span> <span class="o">-</span> <span class="n">1I</span>, <span onmouseout="hideTip(event, 'fstips49', 142)" onmouseover="showTip(event, 'fstips49', 142)" class="i">ackerman</span> (<span onmouseout="hideTip(event, 'fstips50', 143)" onmouseover="showTip(event, 'fstips50', 143)" class="i">m</span>, <span onmouseout="hideTip(event, 'fstips51', 144)" onmouseover="showTip(event, 'fstips51', 144)" class="i">n</span><span class="o">-</span><span class="n">1I</span>))
<span class="l"> 80: </span>
<span class="l"> 81: </span><span class="c">//</span><span class="c"> </span><span class="c">delayed</span><span class="c"> </span><span class="c">by</span><span class="c"> </span><span class="c">our</span><span class="c"> </span><span class="c">Idle</span><span class="c"> </span><span class="c">mechanism</span>
<span class="l"> 82: </span><span class="k">let</span> <span onmouseout="hideTip(event, 'fstips52', 145)" onmouseover="showTip(event, 'fstips52', 145)" class="i">ack3_9</span> <span class="o">=</span> <span onmouseout="hideTip(event, 'fstips53', 146)" onmouseover="showTip(event, 'fstips53', 146)" class="i">Idle</span><span class="o">.</span><span onmouseout="hideTip(event, 'fstips46', 147)" onmouseover="showTip(event, 'fstips46', 147)" class="i">create</span>(<span onmouseout="hideTip(event, 'fstips20', 148)" onmouseover="showTip(event, 'fstips20', 148)" class="i">delayf</span> <span onmouseout="hideTip(event, 'fstips49', 149)" onmouseover="showTip(event, 'fstips49', 149)" class="i">ackerman</span> (<span class="n">3I</span>,<span class="n">9I</span>))
<span class="l"> 83: </span>
<span class="l"> 84: </span><span onmouseout="hideTip(event, 'fstips52', 150)" onmouseover="showTip(event, 'fstips52', 150)" class="i">ack3_9</span><span class="o">.</span><span onmouseout="hideTip(event, 'fstips54', 151)" onmouseover="showTip(event, 'fstips54', 151)" class="i">Value</span></pre>
</p>
<p/>
Fortunately, we don&#8217;t actually have to do all of this ourselves.  F# provides some syntactical sugar for us in the form of a <i>lazy</i> keyword and a <i>Lazy</i> module that provides a functional wrapper over the type <i>Lazy<T></i> in the .NET BCL. Using these faculties is strait forward, and the <i>lazy</i> keyword allows us to create a <i>Lazy<T></i> with any valid F# expression.  So here is a lazy explination of F# lazy…<br />

<pre class="fssnip">
<span class="l"> 85: </span><span class="k">let</span> <span onmouseout="hideTip(event, 'fstips55', 152)" onmouseover="showTip(event, 'fstips55', 152)" class="i">y</span> <span class="o">=</span> <span onmouseout="hideTip(event, 'fstips56', 153)" onmouseover="showTip(event, 'fstips56', 153)" class="i">Lazy</span><span class="o">.</span><span onmouseout="hideTip(event, 'fstips57', 154)" onmouseover="showTip(event, 'fstips57', 154)" class="i">Create</span>(<span class="k">fun</span> () <span class="k">-&gt;</span> <span class="n">5</span>) <span class="c">//</span><span class="c"> </span><span class="c">give</span><span class="c"> </span><span class="c">it</span><span class="c"> </span><span class="c">a</span><span class="c"> </span><span class="c">thunk</span>
<span class="l"> 86: </span><span class="k">let</span> <span onmouseout="hideTip(event, 'fstips58', 155)" onmouseover="showTip(event, 'fstips58', 155)" class="i">x</span> <span class="o">=</span> <span class="k">lazy</span> (<span onmouseout="hideTip(event, 'fstips13', 156)" onmouseover="showTip(event, 'fstips13', 156)" class="i">printfn</span> <span class="s">&quot;</span><span class="s">automatically</span><span class="s"> </span><span class="s">wraps</span><span class="s"> </span><span class="s">your</span><span class="s"> </span><span class="s">expression</span><span class="s"> </span><span class="s">in</span><span class="s"> </span><span class="s">a</span><span class="s"> </span><span class="s">thunk</span><span class="s">&quot;</span>,<span class="n">37</span>)
<span class="l"> 87: </span>
<span class="l"> 88: </span><span onmouseout="hideTip(event, 'fstips55', 157)" onmouseover="showTip(event, 'fstips55', 157)" class="i">y</span><span class="o">.</span><span onmouseout="hideTip(event, 'fstips59', 158)" onmouseover="showTip(event, 'fstips59', 158)" class="i">IsValueCreated</span>                    <span class="c">//</span><span class="c"> </span><span class="c">No</span>
<span class="l"> 89: </span><span onmouseout="hideTip(event, 'fstips58', 159)" onmouseover="showTip(event, 'fstips58', 159)" class="i">x</span><span class="o">.</span><span onmouseout="hideTip(event, 'fstips59', 160)" onmouseover="showTip(event, 'fstips59', 160)" class="i">IsValueCreated</span>                    <span class="c">//</span><span class="c"> </span><span class="c">No</span>
<span class="l"> 90: </span><span onmouseout="hideTip(event, 'fstips55', 161)" onmouseover="showTip(event, 'fstips55', 161)" class="i">y</span><span class="o">.</span><span onmouseout="hideTip(event, 'fstips60', 162)" onmouseover="showTip(event, 'fstips60', 162)" class="i">Force</span>()                           <span class="c">//</span><span class="c"> </span><span class="c">This</span><span class="c"> </span><span class="c">will</span><span class="c"> </span><span class="c">force</span><span class="c"> </span><span class="c">y'</span>
<span class="l"> 91: </span><span onmouseout="hideTip(event, 'fstips55', 163)" onmouseover="showTip(event, 'fstips55', 163)" class="i">y</span><span class="o">.</span><span onmouseout="hideTip(event, 'fstips59', 164)" onmouseover="showTip(event, 'fstips59', 164)" class="i">IsValueCreated</span>                    <span class="c">//</span><span class="c"> </span><span class="c">Yes</span>
<span class="l"> 92: </span><span onmouseout="hideTip(event, 'fstips58', 165)" onmouseover="showTip(event, 'fstips58', 165)" class="i">x</span><span class="o">.</span><span onmouseout="hideTip(event, 'fstips59', 166)" onmouseover="showTip(event, 'fstips59', 166)" class="i">IsValueCreated</span>                    <span class="c">//</span><span class="c"> </span><span class="c">No</span>
<span class="l"> 93: </span><span class="k">let</span> <span onmouseout="hideTip(event, 'fstips61', 167)" onmouseover="showTip(event, 'fstips61', 167)" class="i">result</span> <span class="o">=</span> <span onmouseout="hideTip(event, 'fstips55', 168)" onmouseover="showTip(event, 'fstips55', 168)" class="i">y</span><span class="o">.</span><span onmouseout="hideTip(event, 'fstips62', 169)" onmouseover="showTip(event, 'fstips62', 169)" class="i">Value</span> <span class="o">+</span> (<span onmouseout="hideTip(event, 'fstips63', 170)" onmouseover="showTip(event, 'fstips63', 170)" class="i">snd</span> <span onmouseout="hideTip(event, 'fstips58', 171)" onmouseover="showTip(event, 'fstips58', 171)" class="i">x</span><span class="o">.</span><span onmouseout="hideTip(event, 'fstips64', 172)" onmouseover="showTip(event, 'fstips64', 172)" class="i">Value</span>)<span class="c">//</span><span class="c"> </span><span class="c">Uses</span><span class="c"> </span><span class="c">chached</span><span class="c"> </span><span class="c">y',</span><span class="c"> </span><span class="c">forces</span><span class="c"> </span><span class="c">x'</span>
<span class="l"> 94: </span><span onmouseout="hideTip(event, 'fstips55', 173)" onmouseover="showTip(event, 'fstips55', 173)" class="i">y</span><span class="o">.</span><span onmouseout="hideTip(event, 'fstips59', 174)" onmouseover="showTip(event, 'fstips59', 174)" class="i">IsValueCreated</span>                    <span class="c">//</span><span class="c"> </span><span class="c">Yes</span>
<span class="l"> 95: </span><span onmouseout="hideTip(event, 'fstips58', 175)" onmouseover="showTip(event, 'fstips58', 175)" class="i">x</span><span class="o">.</span><span onmouseout="hideTip(event, 'fstips59', 176)" onmouseover="showTip(event, 'fstips59', 176)" class="i">IsValueCreated</span>                    <span class="c">//</span><span class="c"> </span><span class="c">Yes</span>
<span class="l"> 96: </span><span onmouseout="hideTip(event, 'fstips58', 177)" onmouseover="showTip(event, 'fstips58', 177)" class="i">x</span><span class="o">.</span><span onmouseout="hideTip(event, 'fstips64', 178)" onmouseover="showTip(event, 'fstips64', 178)" class="i">Value</span>                             <span class="c">//</span><span class="c"> </span><span class="c">It's</span><span class="c"> </span><span class="c">cached</span>
<span class="l"> 97: </span><span onmouseout="hideTip(event, 'fstips61', 179)" onmouseover="showTip(event, 'fstips61', 179)" class="i">result</span> <span class="c">//</span><span class="c"> </span><span class="c">is</span><span class="c"> </span><span class="c">bound</span><span class="c"> </span><span class="c">to</span><span class="c"> </span><span class="c">the</span><span class="c"> </span><span class="c">value</span><span class="c"> </span><span class="c">of</span><span class="c"> </span><span class="c">42</span><span class="c"> </span><span class="c">due</span><span class="c"> </span><span class="c">to</span><span class="c"> </span><span class="c">the</span><span class="c"> </span><span class="c">forcing</span><span class="c"> </span><span class="c">of</span><span class="c"> </span><span class="c">x'</span><span class="c"> </span><span class="c">and</span><span class="c"> </span><span class="c">y'</span>
<span class="l"> 98: </span>
<span class="l"> 99: </span><span class="c">//</span><span class="c"> </span><span class="c">this</span><span class="c"> </span><span class="c">should</span><span class="c"> </span><span class="c">verify</span><span class="c"> </span><span class="c">that</span><span class="c"> </span><span class="c">the</span><span class="c"> </span><span class="c">Next</span><span class="c"> </span><span class="c">System.Random</span><span class="c"> </span><span class="c">has</span><span class="c"> </span><span class="c">been</span><span class="c"> </span><span class="c">computed</span><span class="c"> </span><span class="c">only</span><span class="c"> </span><span class="c">once</span>
<span class="l">100: </span><span class="k">let</span> <span onmouseout="hideTip(event, 'fstips65', 180)" onmouseover="showTip(event, 'fstips65', 180)" class="i">multipleForcing</span> <span class="o">=</span> <span class="k">lazy</span> ((<span class="k">new</span> <span onmouseout="hideTip(event, 'fstips1', 181)" onmouseover="showTip(event, 'fstips1', 181)" class="i">System</span><span class="o">.</span><span onmouseout="hideTip(event, 'fstips11', 182)" onmouseover="showTip(event, 'fstips11', 182)" class="i">Random</span>())<span class="o">.</span><span class="i">Next</span> <span class="n">100</span>)
<span class="l">101: </span>[<span class="k">for</span> <span onmouseout="hideTip(event, 'fstips66', 183)" onmouseover="showTip(event, 'fstips66', 183)" class="i">x</span> <span class="k">in</span> <span class="n">1..</span><span class="n">10</span> <span class="k">do</span> <span class="k">yield</span> <span onmouseout="hideTip(event, 'fstips65', 184)" onmouseover="showTip(event, 'fstips65', 184)" class="i">multipleForcing</span><span class="o">.</span><span onmouseout="hideTip(event, 'fstips60', 185)" onmouseover="showTip(event, 'fstips60', 185)" class="i">Force</span>()]
<span class="l">102: </span>
<span class="l">103: </span><span class="k">let</span> <span onmouseout="hideTip(event, 'fstips67', 186)" onmouseover="showTip(event, 'fstips67', 186)" class="i">add</span> <span onmouseout="hideTip(event, 'fstips68', 187)" onmouseover="showTip(event, 'fstips68', 187)" class="i">a</span> <span onmouseout="hideTip(event, 'fstips69', 188)" onmouseover="showTip(event, 'fstips69', 188)" class="i">b</span> <span class="o">=</span> <span onmouseout="hideTip(event, 'fstips68', 189)" onmouseover="showTip(event, 'fstips68', 189)" class="i">a</span> <span class="o">+</span> <span onmouseout="hideTip(event, 'fstips69', 190)" onmouseover="showTip(event, 'fstips69', 190)" class="i">b</span>                  <span class="c">//</span><span class="c"> </span><span class="c">Function</span><span class="c"> </span><span class="c">not</span><span class="c"> </span><span class="c">lazy</span>
<span class="l">104: </span><span class="k">let</span> <span onmouseout="hideTip(event, 'fstips70', 191)" onmouseover="showTip(event, 'fstips70', 191)" class="i">theSum</span>  <span class="o">=</span> <span onmouseout="hideTip(event, 'fstips67', 192)" onmouseover="showTip(event, 'fstips67', 192)" class="i">add</span> <span class="n">41</span> <span class="n">1</span>               <span class="c">//</span><span class="c"> </span><span class="c">Value</span><span class="c"> </span><span class="c">not</span><span class="c"> </span><span class="c">lazy</span>
<span class="l">105: </span><span class="k">let</span> <span onmouseout="hideTip(event, 'fstips71', 193)" onmouseover="showTip(event, 'fstips71', 193)" class="i">sum</span> <span onmouseout="hideTip(event, 'fstips68', 194)" onmouseover="showTip(event, 'fstips68', 194)" class="i">a</span> <span onmouseout="hideTip(event, 'fstips69', 195)" onmouseover="showTip(event, 'fstips69', 195)" class="i">b</span> <span class="o">=</span> <span class="k">lazy</span> ( <span onmouseout="hideTip(event, 'fstips68', 196)" onmouseover="showTip(event, 'fstips68', 196)" class="i">a</span> <span class="o">+</span> <span onmouseout="hideTip(event, 'fstips69', 197)" onmouseover="showTip(event, 'fstips69', 197)" class="i">b</span> )         <span class="c">//</span><span class="c"> </span><span class="c">Function</span><span class="c"> </span><span class="c">is</span><span class="c"> </span><span class="c">lazy</span>
<span class="l">106: </span><span class="k">let</span> <span onmouseout="hideTip(event, 'fstips72', 198)" onmouseover="showTip(event, 'fstips72', 198)" class="i">theSum'</span> <span class="o">=</span> <span onmouseout="hideTip(event, 'fstips71', 199)" onmouseover="showTip(event, 'fstips71', 199)" class="i">sum</span> <span class="n">41</span> <span class="n">1</span>               <span class="c">//</span><span class="c"> </span><span class="c">Value</span><span class="c"> </span><span class="c">is</span><span class="c"> </span><span class="c">lazy</span>
<span class="l">107: </span><span onmouseout="hideTip(event, 'fstips72', 200)" onmouseover="showTip(event, 'fstips72', 200)" class="i">theSum'</span><span class="o">.</span><span onmouseout="hideTip(event, 'fstips60', 201)" onmouseover="showTip(event, 'fstips60', 201)" class="i">Force</span>()                      <span class="c">//</span><span class="c"> </span><span class="c">Force</span><span class="c"> </span><span class="c">it</span><span class="c"> </span><span class="c">when</span><span class="c"> </span><span class="c">you</span><span class="c"> </span><span class="c">want</span>
<span class="l">108: </span>
<span class="l">109: </span><span class="k">module</span> <span onmouseout="hideTip(event, 'fstips56', 202)" onmouseover="showTip(event, 'fstips56', 202)" class="i">Lazy</span> <span class="o">=</span>                        
<span class="l">110: </span>  <span class="k">let</span> <span onmouseout="hideTip(event, 'fstips73', 203)" onmouseover="showTip(event, 'fstips73', 203)" class="i">force</span> (<span onmouseout="hideTip(event, 'fstips74', 204)" onmouseover="showTip(event, 'fstips74', 204)" class="i">x</span> <span class="o">:</span> <span onmouseout="hideTip(event, 'fstips56', 205)" onmouseover="showTip(event, 'fstips56', 205)" class="i">Lazy</span><span class="o">&lt;</span><span class="o">'</span><span class="i">a</span><span class="o">&gt;</span>) <span class="o">=</span>         <span class="c">//</span><span class="c"> </span><span class="c">Make</span><span class="c"> </span><span class="c">a</span><span class="c"> </span><span class="c">helper</span><span class="c"> </span><span class="c">function</span>
<span class="l">111: </span>    <span onmouseout="hideTip(event, 'fstips74', 206)" onmouseover="showTip(event, 'fstips74', 206)" class="i">x</span><span class="o">.</span><span onmouseout="hideTip(event, 'fstips60', 207)" onmouseover="showTip(event, 'fstips60', 207)" class="i">Force</span>()
<span class="l">112: </span>
<span class="l">113: </span><span onmouseout="hideTip(event, 'fstips56', 208)" onmouseover="showTip(event, 'fstips56', 208)" class="i">Lazy</span><span class="o">.</span><span onmouseout="hideTip(event, 'fstips73', 209)" onmouseover="showTip(event, 'fstips73', 209)" class="i">force</span> <span class="o">&lt;|</span> <span onmouseout="hideTip(event, 'fstips71', 210)" onmouseover="showTip(event, 'fstips71', 210)" class="i">sum</span> <span class="n">5</span> <span class="n">37</span>               <span class="c">//</span><span class="c"> </span><span class="c">Use</span><span class="c"> </span><span class="c">it</span><span class="c"> </span><span class="c">like</span><span class="c"> </span><span class="c">this</span>
</pre>
</p>
<p />
In closing, we&#8217;ve taken a look at how to build our own type implementing a Lazy Initialization pattern in the F# language that is made thread-safe by using the F# <i>Operators.lock</i> function wherever the state is accessed.  We&#8217;ve also breifly looked into the F# <i>Lazy</i> module and <i>lazy</i> keyword concluding nothing beats the ability to use lazy as a keyword that implicitly thunks any expression!<br />

<pre class="fssnip"><a target="_blank" class="fssniplink" href="http://tomasp.net/fswebsnippets">F# Web Snippets</a>
</pre>


<!-- HTML code for ToolTips -->
<div class="tip" id="fstips1">namespace System<br /></div>
<div class="tip" id="fstips2">type Object =<br />&#160;&#160;class<br />&#160;&#160;&#160;&#160;new : unit -&gt; obj<br />&#160;&#160;&#160;&#160;member Equals : obj -&gt; bool<br />&#160;&#160;&#160;&#160;member GetHashCode : unit -&gt; int<br />&#160;&#160;&#160;&#160;member GetType : unit -&gt; System.Type<br />&#160;&#160;&#160;&#160;member ToString : unit -&gt; string<br />&#160;&#160;&#160;&#160;static member Equals : obj * obj -&gt; bool<br />&#160;&#160;&#160;&#160;static member ReferenceEquals : obj * obj -&gt; bool<br />&#160;&#160;end<br /><br />Full name: System.Object<br /></div>
<div class="tip" id="fstips3">val o : ComplicatedObject<br /><br />Full name: Creational.DesignPatterns.LazyInitialization.o<br /></div>
<div class="tip" id="fstips4">type ComplicatedObject = System.Object<br /><br />Full name: Creational.DesignPatterns.LazyInitialization.ComplicatedObject<br /></div>
<div class="tip" id="fstips5">val f : unit -&gt; ComplicatedObject<br /><br />Full name: Creational.DesignPatterns.LazyInitialization.f<br /></div>
<div class="tip" id="fstips6">type Cat =<br />&#160;&#160;| Alive<br />&#160;&#160;| Dead<br /><br />Full name: Creational.DesignPatterns.LazyInitialization.Cat<br /><br />&#160;&#160;type: Cat<br />&#160;&#160;implements: System.IEquatable&lt;Cat&gt;<br />&#160;&#160;implements: System.Collections.IStructuralEquatable<br />&#160;&#160;implements: System.IComparable&lt;Cat&gt;<br />&#160;&#160;implements: System.IComparable<br />&#160;&#160;implements: System.Collections.IStructuralComparable<br /></div>
<div class="tip" id="fstips7">union case Cat.Alive: Cat<br /></div>
<div class="tip" id="fstips8">union case Cat.Dead: Cat<br /></div>
<div class="tip" id="fstips9">val whatsInTheBox : unit -&gt; unit<br /><br />Full name: Creational.DesignPatterns.LazyInitialization.whatsInTheBox<br /></div>
<div class="tip" id="fstips10">val aliveOrDead : Cat<br /><br />&#160;&#160;type: Cat<br />&#160;&#160;implements: System.IEquatable&lt;Cat&gt;<br />&#160;&#160;implements: System.Collections.IStructuralEquatable<br />&#160;&#160;implements: System.IComparable&lt;Cat&gt;<br />&#160;&#160;implements: System.IComparable<br />&#160;&#160;implements: System.Collections.IStructuralComparable<br /></div>
<div class="tip" id="fstips11">type Random =<br />&#160;&#160;class<br />&#160;&#160;&#160;&#160;new : unit -&gt; System.Random<br />&#160;&#160;&#160;&#160;new : int -&gt; System.Random<br />&#160;&#160;&#160;&#160;member Next : unit -&gt; int<br />&#160;&#160;&#160;&#160;member Next : int -&gt; int<br />&#160;&#160;&#160;&#160;member Next : int * int -&gt; int<br />&#160;&#160;&#160;&#160;member NextBytes : System.Byte [] -&gt; unit<br />&#160;&#160;&#160;&#160;member NextDouble : unit -&gt; float<br />&#160;&#160;end<br /><br />Full name: System.Random<br /></div>
<div class="tip" id="fstips12">val alive : unit<br /><br />&#160;&#160;type: unit<br />&#160;&#160;implements: System.IComparable<br /></div>
<div class="tip" id="fstips13">val printfn : Printf.TextWriterFormat&lt;'T&gt; -&gt; 'T<br /><br />Full name: Microsoft.FSharp.Core.ExtraTopLevelOperators.printfn<br /></div>
<div class="tip" id="fstips14">val dead : unit<br /><br />&#160;&#160;type: unit<br />&#160;&#160;implements: System.IComparable<br /></div>
<div class="tip" id="fstips15">val openTheBox : unit -&gt; (unit -&gt; unit)<br /><br />Full name: Creational.DesignPatterns.LazyInitialization.openTheBox<br /></div>
<div class="tip" id="fstips16">val alive : (unit -&gt; unit)<br /></div>
<div class="tip" id="fstips17">val dead : (unit -&gt; unit)<br /></div>
<div class="tip" id="fstips18">val delay : 'a -&gt; unit -&gt; 'a<br /><br />Full name: Creational.DesignPatterns.LazyInitialization.delay<br /></div>
<div class="tip" id="fstips19">val x : 'a<br /></div>
<div class="tip" id="fstips20">val delayf : ('a -&gt; 'b) -&gt; 'a -&gt; unit -&gt; 'b<br /><br />Full name: Creational.DesignPatterns.LazyInitialization.delayf<br /></div>
<div class="tip" id="fstips21">val f : ('a -&gt; 'b)<br /></div>
<div class="tip" id="fstips22">val delayAny : 'a -&gt; 'b -&gt; 'a<br /><br />Full name: Creational.DesignPatterns.LazyInitialization.delayAny<br /></div>
<div class="tip" id="fstips23">val delayNew : unit -&gt; 'a (requires default constructor)<br /><br />Full name: Creational.DesignPatterns.LazyInitialization.delayNew<br /></div>
<div class="tip" id="fstips24">type unit = Unit<br /><br />Full name: Microsoft.FSharp.Core.unit<br /><br />&#160;&#160;type: unit<br />&#160;&#160;implements: System.IComparable<br /></div>
<div class="tip" id="fstips25">type IdleState&lt;'a&gt; =<br />&#160;&#160;| Delayed of (unit -&gt; 'a)<br />&#160;&#160;| Cached of 'a<br />&#160;&#160;| Exception of System.Exception<br /><br />Full name: Creational.DesignPatterns.LazyInitialization.IdleState&lt;_&gt;<br /></div>
<div class="tip" id="fstips26">union case IdleState.Delayed: (unit -&gt; 'a) -&gt; IdleState&lt;'a&gt;<br /></div>
<div class="tip" id="fstips27">union case IdleState.Cached: 'a -&gt; IdleState&lt;'a&gt;<br /></div>
<div class="tip" id="fstips28">union case IdleState.Exception: System.Exception -&gt; IdleState&lt;'a&gt;<br /></div>
<div class="tip" id="fstips29">type Exception =<br />&#160;&#160;class<br />&#160;&#160;&#160;&#160;new : unit -&gt; System.Exception<br />&#160;&#160;&#160;&#160;new : string -&gt; System.Exception<br />&#160;&#160;&#160;&#160;new : string * System.Exception -&gt; System.Exception<br />&#160;&#160;&#160;&#160;member Data : System.Collections.IDictionary<br />&#160;&#160;&#160;&#160;member GetBaseException : unit -&gt; System.Exception<br />&#160;&#160;&#160;&#160;member GetObjectData : System.Runtime.Serialization.SerializationInfo * System.Runtime.Serialization.StreamingContext -&gt; unit<br />&#160;&#160;&#160;&#160;member GetType : unit -&gt; System.Type<br />&#160;&#160;&#160;&#160;member HelpLink : string with get, set<br />&#160;&#160;&#160;&#160;member InnerException : System.Exception<br />&#160;&#160;&#160;&#160;member Message : string<br />&#160;&#160;&#160;&#160;member Source : string with get, set<br />&#160;&#160;&#160;&#160;member StackTrace : string<br />&#160;&#160;&#160;&#160;member TargetSite : System.Reflection.MethodBase<br />&#160;&#160;&#160;&#160;member ToString : unit -&gt; string<br />&#160;&#160;end<br /><br />Full name: System.Exception<br /><br />&#160;&#160;type: System.Exception<br />&#160;&#160;implements: System.Runtime.Serialization.ISerializable<br />&#160;&#160;implements: System.Runtime.InteropServices._Exception<br /></div>
<div class="tip" id="fstips30">type Idle&lt;'a&gt; =<br />&#160;&#160;{mutable status: IdleState&lt;'a&gt;;}<br />&#160;&#160;with<br />&#160;&#160;&#160;&#160;member Force : unit -&gt; 'a<br />&#160;&#160;&#160;&#160;member IsValueCreated : bool<br />&#160;&#160;&#160;&#160;member Value : 'a<br />&#160;&#160;&#160;&#160;static member Create : f:(unit -&gt; 'a0) -&gt; Idle&lt;'a0&gt;<br />&#160;&#160;end<br /><br />Full name: Creational.DesignPatterns.LazyInitialization.Idle&lt;_&gt;<br /></div>
<div class="tip" id="fstips31">Idle.status: IdleState&lt;'a&gt;<br /></div>
<div class="tip" id="fstips32">static member Idle.Create : f:(unit -&gt; 'a0) -&gt; Idle&lt;'a0&gt;<br /><br />Full name: Creational.DesignPatterns.LazyInitialization.Idle`1.Create<br /></div>
<div class="tip" id="fstips33">val f : (unit -&gt; 'a)<br /></div>
<div class="tip" id="fstips34">val x : Idle&lt;'a&gt;<br /></div>
<div class="tip" id="fstips35">property Idle.IsValueCreated: bool<br /></div>
<div class="tip" id="fstips36">val lock : 'Lock -&gt; (unit -&gt; 'T) -&gt; 'T (requires reference type)<br /><br />Full name: Microsoft.FSharp.Core.Operators.lock<br /></div>
<div class="tip" id="fstips37">member Idle.Force : unit -&gt; 'a<br /><br />Full name: Creational.DesignPatterns.LazyInitialization.Idle`1.Force<br /></div>
<div class="tip" id="fstips38">val v : 'a<br /></div>
<div class="tip" id="fstips39">Multiple items
<br />val e : exn<br /><br />&#160;&#160;type: exn<br />&#160;&#160;implements: System.Runtime.Serialization.ISerializable<br />&#160;&#160;implements: System.Runtime.InteropServices._Exception<br />
<br /><br />--------------------<br />
<br />val e : exn<br /><br />&#160;&#160;type: exn<br />&#160;&#160;implements: System.Runtime.Serialization.ISerializable<br />&#160;&#160;implements: System.Runtime.InteropServices._Exception<br /></div>
<div class="tip" id="fstips40">val e : exn<br /><br />&#160;&#160;type: exn<br />&#160;&#160;implements: System.Runtime.Serialization.ISerializable<br />&#160;&#160;implements: System.Runtime.InteropServices._Exception<br /></div>
<div class="tip" id="fstips41">val reraise : unit -&gt; 'T<br /><br />Full name: Microsoft.FSharp.Core.Operators.reraise<br /></div>
<div class="tip" id="fstips42">val e : System.Exception<br /><br />&#160;&#160;type: System.Exception<br />&#160;&#160;implements: System.Runtime.Serialization.ISerializable<br />&#160;&#160;implements: System.Runtime.InteropServices._Exception<br /></div>
<div class="tip" id="fstips43">val raise : System.Exception -&gt; 'T<br /><br />Full name: Microsoft.FSharp.Core.Operators.raise<br /></div>
<div class="tip" id="fstips44">property Idle.Value: 'a<br /></div>
<div class="tip" id="fstips45">member Idle.Force : unit -&gt; 'a<br /></div>
<div class="tip" id="fstips46">val create : (unit -&gt; 'a) -&gt; Idle&lt;'a&gt;<br /><br />Full name: Creational.DesignPatterns.LazyInitialization.Idle.create<br /></div>
<div class="tip" id="fstips47">static member Idle.Create : f:(unit -&gt; 'a0) -&gt; Idle&lt;'a0&gt;<br /></div>
<div class="tip" id="fstips48">val force : Idle&lt;'a&gt; -&gt; 'a<br /><br />Full name: Creational.DesignPatterns.LazyInitialization.Idle.force<br /></div>
<div class="tip" id="fstips49">val ackerman : System.Numerics.BigInteger * System.Numerics.BigInteger -&gt; System.Numerics.BigInteger<br /><br />Full name: Creational.DesignPatterns.LazyInitialization.ackerman<br /></div>
<div class="tip" id="fstips50">val m : System.Numerics.BigInteger<br /><br />&#160;&#160;type: System.Numerics.BigInteger<br />&#160;&#160;implements: System.IFormattable<br />&#160;&#160;implements: System.IComparable<br />&#160;&#160;implements: System.IComparable&lt;System.Numerics.BigInteger&gt;<br />&#160;&#160;implements: System.IEquatable&lt;System.Numerics.BigInteger&gt;<br />&#160;&#160;inherits: System.ValueType<br /></div>
<div class="tip" id="fstips51">val n : System.Numerics.BigInteger<br /><br />&#160;&#160;type: System.Numerics.BigInteger<br />&#160;&#160;implements: System.IFormattable<br />&#160;&#160;implements: System.IComparable<br />&#160;&#160;implements: System.IComparable&lt;System.Numerics.BigInteger&gt;<br />&#160;&#160;implements: System.IEquatable&lt;System.Numerics.BigInteger&gt;<br />&#160;&#160;inherits: System.ValueType<br /></div>
<div class="tip" id="fstips52">val ack3_9 : Idle&lt;System.Numerics.BigInteger&gt;<br /><br />Full name: Creational.DesignPatterns.LazyInitialization.ack3_9<br /></div>
<div class="tip" id="fstips53">Multiple items
<br />module Idle<br /><br />from Creational.DesignPatterns.LazyInitialization
<br /><br />--------------------<br />
<br />type Idle&lt;'a&gt; =<br />&#160;&#160;{mutable status: IdleState&lt;'a&gt;;}<br />&#160;&#160;with<br />&#160;&#160;&#160;&#160;member Force : unit -&gt; 'a<br />&#160;&#160;&#160;&#160;member IsValueCreated : bool<br />&#160;&#160;&#160;&#160;member Value : 'a<br />&#160;&#160;&#160;&#160;static member Create : f:(unit -&gt; 'a0) -&gt; Idle&lt;'a0&gt;<br />&#160;&#160;end<br /><br />Full name: Creational.DesignPatterns.LazyInitialization.Idle&lt;_&gt;<br /></div>
<div class="tip" id="fstips54">property Idle.Value: System.Numerics.BigInteger<br /></div>
<div class="tip" id="fstips55">val y : System.Lazy&lt;int&gt;<br /><br />Full name: Creational.DesignPatterns.LazyInitialization.y<br /></div>
<div class="tip" id="fstips56">Multiple items
<br />active recognizer Lazy: Lazy&lt;'T&gt; -&gt; 'T<br /><br />Full name: Microsoft.FSharp.Core.ExtraTopLevelOperators.( |Lazy| )
<br /><br />--------------------<br />
<br />type Lazy&lt;'T&gt; = System.Lazy&lt;'T&gt;<br /><br />Full name: Microsoft.FSharp.Control.Lazy&lt;_&gt;<br /></div>
<div class="tip" id="fstips57">static member System.Lazy.Create : creator:(unit -&gt; 'T) -&gt; System.Lazy&lt;'T&gt;<br /></div>
<div class="tip" id="fstips58">val x : Lazy&lt;unit * int&gt;<br /><br />Full name: Creational.DesignPatterns.LazyInitialization.x<br /></div>
<div class="tip" id="fstips59">property System.Lazy.IsValueCreated: bool<br /></div>
<div class="tip" id="fstips60">member System.Lazy.Force : unit -&gt; 'T<br /></div>
<div class="tip" id="fstips61">val result : int<br /><br />Full name: Creational.DesignPatterns.LazyInitialization.result<br /><br />&#160;&#160;type: int<br />&#160;&#160;implements: System.IComparable<br />&#160;&#160;implements: System.IFormattable<br />&#160;&#160;implements: System.IConvertible<br />&#160;&#160;implements: System.IComparable&lt;int&gt;<br />&#160;&#160;implements: System.IEquatable&lt;int&gt;<br />&#160;&#160;inherits: System.ValueType<br /></div>
<div class="tip" id="fstips62">property System.Lazy.Value: int<br /></div>
<div class="tip" id="fstips63">val snd : ('T1 * 'T2) -&gt; 'T2<br /><br />Full name: Microsoft.FSharp.Core.Operators.snd<br /></div>
<div class="tip" id="fstips64">property System.Lazy.Value: unit * int<br /></div>
<div class="tip" id="fstips65">val multipleForcing : Lazy&lt;int&gt;<br /><br />Full name: Creational.DesignPatterns.LazyInitialization.multipleForcing<br /></div>
<div class="tip" id="fstips66">val x : int<br /><br />&#160;&#160;type: int<br />&#160;&#160;implements: System.IComparable<br />&#160;&#160;implements: System.IFormattable<br />&#160;&#160;implements: System.IConvertible<br />&#160;&#160;implements: System.IComparable&lt;int&gt;<br />&#160;&#160;implements: System.IEquatable&lt;int&gt;<br />&#160;&#160;inherits: System.ValueType<br /></div>
<div class="tip" id="fstips67">val add : int -&gt; int -&gt; int<br /><br />Full name: Creational.DesignPatterns.LazyInitialization.add<br /></div>
<div class="tip" id="fstips68">val a : int<br /><br />&#160;&#160;type: int<br />&#160;&#160;implements: System.IComparable<br />&#160;&#160;implements: System.IFormattable<br />&#160;&#160;implements: System.IConvertible<br />&#160;&#160;implements: System.IComparable&lt;int&gt;<br />&#160;&#160;implements: System.IEquatable&lt;int&gt;<br />&#160;&#160;inherits: System.ValueType<br /></div>
<div class="tip" id="fstips69">val b : int<br /><br />&#160;&#160;type: int<br />&#160;&#160;implements: System.IComparable<br />&#160;&#160;implements: System.IFormattable<br />&#160;&#160;implements: System.IConvertible<br />&#160;&#160;implements: System.IComparable&lt;int&gt;<br />&#160;&#160;implements: System.IEquatable&lt;int&gt;<br />&#160;&#160;inherits: System.ValueType<br /></div>
<div class="tip" id="fstips70">val theSum : int<br /><br />Full name: Creational.DesignPatterns.LazyInitialization.theSum<br /><br />&#160;&#160;type: int<br />&#160;&#160;implements: System.IComparable<br />&#160;&#160;implements: System.IFormattable<br />&#160;&#160;implements: System.IConvertible<br />&#160;&#160;implements: System.IComparable&lt;int&gt;<br />&#160;&#160;implements: System.IEquatable&lt;int&gt;<br />&#160;&#160;inherits: System.ValueType<br /></div>
<div class="tip" id="fstips71">val sum : int -&gt; int -&gt; Lazy&lt;int&gt;<br /><br />Full name: Creational.DesignPatterns.LazyInitialization.sum<br /></div>
<div class="tip" id="fstips72">val theSum' : Lazy&lt;int&gt;<br /><br />Full name: Creational.DesignPatterns.LazyInitialization.theSum'<br /></div>
<div class="tip" id="fstips73">val force : Lazy&lt;'a&gt; -&gt; 'a<br /><br />Full name: Creational.DesignPatterns.LazyInitialization.Lazy.force<br /></div>
<div class="tip" id="fstips74">val x : Lazy&lt;'a&gt;<br /></div>
</p>
 <img src="http://blog.thinkhard.net/wp-content/plugins/wordpress-feed-statistics/feed-statistics.php?view=1&post_id=61" width="1" height="1" style="display: none;" />]]></content:encoded>
			<wfw:commentRss>http://blog.thinkhard.net/2011/06/creational-design-pattern-lazy-initialization/feed/</wfw:commentRss>
		<slash:comments>25</slash:comments>
		</item>
		<item>
		<title>Arrow Notation via F#</title>
		<link>http://blog.thinkhard.net/2011/03/arrow-notation-via-f/</link>
		<comments>http://blog.thinkhard.net/2011/03/arrow-notation-via-f/#comments</comments>
		<pubDate>Fri, 04 Mar 2011 23:32:14 +0000</pubDate>
		<dc:creator>ninegrid ⋮⋮⋮</dc:creator>
				<category><![CDATA[F#]]></category>
		<category><![CDATA[Functional Programming]]></category>

		<guid isPermaLink="false">http://blog.thinkhard.net/?p=53</guid>
		<description><![CDATA[In object oriented programming, a class is a blueprint to create instances of a type. That should keep your FSI busy for a moment while you read the rest of this post. It’s not a secret that there are quite a few types available to us in .NET and we get a handful or two ]]></description>
			<content:encoded><![CDATA[<p>In object oriented programming, a class is a blueprint to create instances of a type.<br />

<pre class="fssnip"><span class="l">  1: </span><span class="c">//</span><span class="c"> </span><span class="c">show</span><span class="c"> </span><span class="c">me</span><span class="c"> </span><span class="c">all</span><span class="c"> </span><span class="c">the</span><span class="c"> </span><span class="c">blueprints</span><span class="c"> </span><span class="c">--</span><span class="c"> </span><span class="c">reflect</span><span class="c"> </span><span class="c">over</span><span class="c"> </span><span class="c">some</span><span class="c"> </span><span class="c">.NET</span><span class="c"> </span><span class="c">libs</span>
<span class="l">  2: </span><span class="k">open</span> <span class="i" onmouseover="showTip(event, 'fstips1', 1)" onmouseout="hideTip(event, 'fstips1', 1)">System</span>
<span class="l">  3: </span><span class="k">open</span> <span class="i" onmouseover="showTip(event, 'fstips1', 2)" onmouseout="hideTip(event, 'fstips1', 2)">System</span><span class="o">.</span><span class="i" onmouseover="showTip(event, 'fstips2', 3)" onmouseout="hideTip(event, 'fstips2', 3)">IO</span>
<span class="l">  4: </span><span class="k">open</span> <span class="i" onmouseover="showTip(event, 'fstips1', 4)" onmouseout="hideTip(event, 'fstips1', 4)">System</span><span class="o">.</span><span class="i" onmouseover="showTip(event, 'fstips3', 5)" onmouseout="hideTip(event, 'fstips3', 5)">Reflection</span>
<span class="l">  5: </span>
<span class="l">  6: </span><span class="c">//</span><span class="c"> </span><span class="c">some</span><span class="c"> </span><span class="c">reflection</span><span class="c"> </span><span class="c">helpers</span>
<span class="l">  7: </span><span class="k">module</span> <span class="i">Reflect</span> <span class="o">=</span>
<span class="l">  8: </span>  <span class="k">type</span> <span class="i" onmouseover="showTip(event, 'fstips4', 6)" onmouseout="hideTip(event, 'fstips4', 6)">Info</span> <span class="o">=</span>
<span class="l">  9: </span>    | <span class="i" onmouseover="showTip(event, 'fstips5', 7)" onmouseout="hideTip(event, 'fstips5', 7)">Types</span>        <span class="k">of</span> <span class="i" onmouseover="showTip(event, 'fstips6', 8)" onmouseout="hideTip(event, 'fstips6', 8)">Type</span>
<span class="l"> 10: </span>    | <span class="i" onmouseover="showTip(event, 'fstips7', 9)" onmouseout="hideTip(event, 'fstips7', 9)">Fields</span>       <span class="k">of</span> <span class="i" onmouseover="showTip(event, 'fstips8', 10)" onmouseout="hideTip(event, 'fstips8', 10)">FieldInfo</span>
<span class="l"> 11: </span>    | <span class="i" onmouseover="showTip(event, 'fstips9', 11)" onmouseout="hideTip(event, 'fstips9', 11)">Properties</span>   <span class="k">of</span> <span class="i" onmouseover="showTip(event, 'fstips10', 12)" onmouseout="hideTip(event, 'fstips10', 12)">PropertyInfo</span>
<span class="l"> 12: </span>    | <span class="i" onmouseover="showTip(event, 'fstips11', 13)" onmouseout="hideTip(event, 'fstips11', 13)">Events</span>       <span class="k">of</span> <span class="i" onmouseover="showTip(event, 'fstips12', 14)" onmouseout="hideTip(event, 'fstips12', 14)">EventInfo</span>
<span class="l"> 13: </span>    | <span class="i" onmouseover="showTip(event, 'fstips13', 15)" onmouseout="hideTip(event, 'fstips13', 15)">Methods</span>      <span class="k">of</span> <span class="i" onmouseover="showTip(event, 'fstips14', 16)" onmouseout="hideTip(event, 'fstips14', 16)">MethodInfo</span>
<span class="l"> 14: </span>    | <span class="i" onmouseover="showTip(event, 'fstips15', 17)" onmouseout="hideTip(event, 'fstips15', 17)">Constructors</span> <span class="k">of</span> <span class="i" onmouseover="showTip(event, 'fstips16', 18)" onmouseout="hideTip(event, 'fstips16', 18)">ConstructorInfo</span>
<span class="l"> 15: </span>
<span class="l"> 16: </span>  <span class="k">let</span> <span class="i" onmouseover="showTip(event, 'fstips17', 19)" onmouseout="hideTip(event, 'fstips17', 19)">getTypes</span> (<span class="i" onmouseover="showTip(event, 'fstips18', 20)" onmouseout="hideTip(event, 'fstips18', 20)">x</span> <span class="o">:</span> <span class="i" onmouseover="showTip(event, 'fstips19', 21)" onmouseout="hideTip(event, 'fstips19', 21)">string</span>) <span class="o">=</span> 
<span class="l"> 17: </span>    <span class="k">let</span> <span class="i" onmouseover="showTip(event, 'fstips20', 22)" onmouseout="hideTip(event, 'fstips20', 22)">asm</span> <span class="o">=</span> <span class="i" onmouseover="showTip(event, 'fstips21', 23)" onmouseout="hideTip(event, 'fstips21', 23)">Assembly</span><span class="o">.</span><span class="i" onmouseover="showTip(event, 'fstips22', 24)" onmouseout="hideTip(event, 'fstips22', 24)">LoadFrom</span>(<span class="i" onmouseover="showTip(event, 'fstips18', 25)" onmouseout="hideTip(event, 'fstips18', 25)">x</span>) <span class="k">in</span> <span class="i" onmouseover="showTip(event, 'fstips20', 26)" onmouseout="hideTip(event, 'fstips20', 26)">asm</span><span class="o">.</span><span class="i" onmouseover="showTip(event, 'fstips23', 27)" onmouseout="hideTip(event, 'fstips23', 27)">GetTypes</span>()
<span class="l"> 18: </span>    <span class="o">|&gt;</span> <span class="i" onmouseover="showTip(event, 'fstips24', 28)" onmouseout="hideTip(event, 'fstips24', 28)">Seq</span><span class="o">.</span><span class="i" onmouseover="showTip(event, 'fstips25', 29)" onmouseout="hideTip(event, 'fstips25', 29)">map</span> (<span class="k">fun</span> <span class="i" onmouseover="showTip(event, 'fstips26', 30)" onmouseout="hideTip(event, 'fstips26', 30)">x</span> <span class="k">-&gt;</span> <span class="i" onmouseover="showTip(event, 'fstips5', 31)" onmouseout="hideTip(event, 'fstips5', 31)">Types</span> <span class="i" onmouseover="showTip(event, 'fstips26', 32)" onmouseout="hideTip(event, 'fstips26', 32)">x</span>)
<span class="l"> 19: </span>
<span class="l"> 20: </span>  <span class="k">let</span> <span class="i" onmouseover="showTip(event, 'fstips27', 33)" onmouseout="hideTip(event, 'fstips27', 33)">getType</span> ( <span class="i" onmouseover="showTip(event, 'fstips28', 34)" onmouseout="hideTip(event, 'fstips28', 34)">x</span> <span class="o">:</span> <span class="i" onmouseover="showTip(event, 'fstips29', 35)" onmouseout="hideTip(event, 'fstips29', 35)">obj</span> ) <span class="o">:</span> <span class="i" onmouseover="showTip(event, 'fstips6', 36)" onmouseout="hideTip(event, 'fstips6', 36)">Type</span> <span class="o">=</span>
<span class="l"> 21: </span>    <span class="k">let</span> <span class="i" onmouseover="showTip(event, 'fstips30', 37)" onmouseout="hideTip(event, 'fstips30', 37)">y</span> <span class="o">=</span> <span class="i" onmouseover="showTip(event, 'fstips28', 38)" onmouseout="hideTip(event, 'fstips28', 38)">x</span><span class="o">.</span><span class="i" onmouseover="showTip(event, 'fstips31', 39)" onmouseout="hideTip(event, 'fstips31', 39)">GetType</span>() <span class="k">in</span> <span class="i" onmouseover="showTip(event, 'fstips30', 40)" onmouseout="hideTip(event, 'fstips30', 40)">y</span>
<span class="l"> 22: </span>
<span class="l"> 23: </span>  <span class="k">let</span> <span class="i" onmouseover="showTip(event, 'fstips32', 41)" onmouseout="hideTip(event, 'fstips32', 41)">getFields</span> (<span class="i" onmouseover="showTip(event, 'fstips28', 42)" onmouseout="hideTip(event, 'fstips28', 42)">x</span> <span class="o">:</span> <span class="i" onmouseover="showTip(event, 'fstips29', 43)" onmouseout="hideTip(event, 'fstips29', 43)">obj</span>) (<span class="i" onmouseover="showTip(event, 'fstips33', 44)" onmouseout="hideTip(event, 'fstips33', 44)">flags</span> <span class="o">:</span> <span class="i" onmouseover="showTip(event, 'fstips34', 45)" onmouseout="hideTip(event, 'fstips34', 45)">BindingFlags</span>) <span class="o">=</span>
<span class="l"> 24: </span>    <span class="k">let</span> <span class="i" onmouseover="showTip(event, 'fstips35', 46)" onmouseout="hideTip(event, 'fstips35', 46)">t</span> <span class="o">=</span> <span class="i" onmouseover="showTip(event, 'fstips27', 47)" onmouseout="hideTip(event, 'fstips27', 47)">getType</span> <span class="i" onmouseover="showTip(event, 'fstips28', 48)" onmouseout="hideTip(event, 'fstips28', 48)">x</span> <span class="k">in</span> <span class="i" onmouseover="showTip(event, 'fstips35', 49)" onmouseout="hideTip(event, 'fstips35', 49)">t</span><span class="o">.</span><span class="i" onmouseover="showTip(event, 'fstips36', 50)" onmouseout="hideTip(event, 'fstips36', 50)">GetFields</span> <span class="i" onmouseover="showTip(event, 'fstips33', 51)" onmouseout="hideTip(event, 'fstips33', 51)">flags</span> 
<span class="l"> 25: </span>    <span class="o">|&gt;</span> <span class="i" onmouseover="showTip(event, 'fstips24', 52)" onmouseout="hideTip(event, 'fstips24', 52)">Seq</span><span class="o">.</span><span class="i" onmouseover="showTip(event, 'fstips25', 53)" onmouseout="hideTip(event, 'fstips25', 53)">map</span> (<span class="k">fun</span> <span class="i" onmouseover="showTip(event, 'fstips37', 54)" onmouseout="hideTip(event, 'fstips37', 54)">x</span> <span class="k">-&gt;</span> <span class="i" onmouseover="showTip(event, 'fstips7', 55)" onmouseout="hideTip(event, 'fstips7', 55)">Fields</span> <span class="i" onmouseover="showTip(event, 'fstips37', 56)" onmouseout="hideTip(event, 'fstips37', 56)">x</span>)
<span class="l"> 26: </span>
<span class="l"> 27: </span>  <span class="k">let</span> <span class="i" onmouseover="showTip(event, 'fstips38', 57)" onmouseout="hideTip(event, 'fstips38', 57)">getProperties</span> (<span class="i" onmouseover="showTip(event, 'fstips28', 58)" onmouseout="hideTip(event, 'fstips28', 58)">x</span> <span class="o">:</span> <span class="i" onmouseover="showTip(event, 'fstips29', 59)" onmouseout="hideTip(event, 'fstips29', 59)">obj</span>) (<span class="i" onmouseover="showTip(event, 'fstips33', 60)" onmouseout="hideTip(event, 'fstips33', 60)">flags</span> <span class="o">:</span> <span class="i" onmouseover="showTip(event, 'fstips34', 61)" onmouseout="hideTip(event, 'fstips34', 61)">BindingFlags</span>) <span class="o">=</span>
<span class="l"> 28: </span>    <span class="k">let</span> <span class="i" onmouseover="showTip(event, 'fstips35', 62)" onmouseout="hideTip(event, 'fstips35', 62)">t</span> <span class="o">=</span> <span class="i" onmouseover="showTip(event, 'fstips27', 63)" onmouseout="hideTip(event, 'fstips27', 63)">getType</span> <span class="i" onmouseover="showTip(event, 'fstips28', 64)" onmouseout="hideTip(event, 'fstips28', 64)">x</span> <span class="k">in</span> <span class="i" onmouseover="showTip(event, 'fstips35', 65)" onmouseout="hideTip(event, 'fstips35', 65)">t</span><span class="o">.</span><span class="i" onmouseover="showTip(event, 'fstips39', 66)" onmouseout="hideTip(event, 'fstips39', 66)">GetProperties</span> <span class="i" onmouseover="showTip(event, 'fstips33', 67)" onmouseout="hideTip(event, 'fstips33', 67)">flags</span>
<span class="l"> 29: </span>    <span class="o">|&gt;</span> <span class="i" onmouseover="showTip(event, 'fstips24', 68)" onmouseout="hideTip(event, 'fstips24', 68)">Seq</span><span class="o">.</span><span class="i" onmouseover="showTip(event, 'fstips25', 69)" onmouseout="hideTip(event, 'fstips25', 69)">map</span> (<span class="k">fun</span> <span class="i" onmouseover="showTip(event, 'fstips40', 70)" onmouseout="hideTip(event, 'fstips40', 70)">x</span> <span class="k">-&gt;</span> <span class="i" onmouseover="showTip(event, 'fstips9', 71)" onmouseout="hideTip(event, 'fstips9', 71)">Properties</span> <span class="i" onmouseover="showTip(event, 'fstips40', 72)" onmouseout="hideTip(event, 'fstips40', 72)">x</span>)
<span class="l"> 30: </span>
<span class="l"> 31: </span>  <span class="k">let</span> <span class="i" onmouseover="showTip(event, 'fstips41', 73)" onmouseout="hideTip(event, 'fstips41', 73)">getEvents</span> (<span class="i" onmouseover="showTip(event, 'fstips28', 74)" onmouseout="hideTip(event, 'fstips28', 74)">x</span> <span class="o">:</span> <span class="i" onmouseover="showTip(event, 'fstips29', 75)" onmouseout="hideTip(event, 'fstips29', 75)">obj</span>) (<span class="i" onmouseover="showTip(event, 'fstips33', 76)" onmouseout="hideTip(event, 'fstips33', 76)">flags</span> <span class="o">:</span> <span class="i" onmouseover="showTip(event, 'fstips34', 77)" onmouseout="hideTip(event, 'fstips34', 77)">BindingFlags</span>) <span class="o">=</span>
<span class="l"> 32: </span>    <span class="k">let</span> <span class="i" onmouseover="showTip(event, 'fstips35', 78)" onmouseout="hideTip(event, 'fstips35', 78)">t</span> <span class="o">=</span> <span class="i" onmouseover="showTip(event, 'fstips27', 79)" onmouseout="hideTip(event, 'fstips27', 79)">getType</span> <span class="i" onmouseover="showTip(event, 'fstips28', 80)" onmouseout="hideTip(event, 'fstips28', 80)">x</span> <span class="k">in</span> <span class="i" onmouseover="showTip(event, 'fstips35', 81)" onmouseout="hideTip(event, 'fstips35', 81)">t</span><span class="o">.</span><span class="i" onmouseover="showTip(event, 'fstips42', 82)" onmouseout="hideTip(event, 'fstips42', 82)">GetEvents</span> <span class="i" onmouseover="showTip(event, 'fstips33', 83)" onmouseout="hideTip(event, 'fstips33', 83)">flags</span>
<span class="l"> 33: </span>    <span class="o">|&gt;</span> <span class="i" onmouseover="showTip(event, 'fstips24', 84)" onmouseout="hideTip(event, 'fstips24', 84)">Seq</span><span class="o">.</span><span class="i" onmouseover="showTip(event, 'fstips25', 85)" onmouseout="hideTip(event, 'fstips25', 85)">map</span> (<span class="k">fun</span> <span class="i" onmouseover="showTip(event, 'fstips43', 86)" onmouseout="hideTip(event, 'fstips43', 86)">x</span> <span class="k">-&gt;</span> <span class="i" onmouseover="showTip(event, 'fstips11', 87)" onmouseout="hideTip(event, 'fstips11', 87)">Events</span> <span class="i" onmouseover="showTip(event, 'fstips43', 88)" onmouseout="hideTip(event, 'fstips43', 88)">x</span>)
<span class="l"> 34: </span>
<span class="l"> 35: </span>  <span class="k">let</span> <span class="i" onmouseover="showTip(event, 'fstips44', 89)" onmouseout="hideTip(event, 'fstips44', 89)">getMethods</span> (<span class="i" onmouseover="showTip(event, 'fstips28', 90)" onmouseout="hideTip(event, 'fstips28', 90)">x</span> <span class="o">:</span> <span class="i" onmouseover="showTip(event, 'fstips29', 91)" onmouseout="hideTip(event, 'fstips29', 91)">obj</span>) (<span class="i" onmouseover="showTip(event, 'fstips33', 92)" onmouseout="hideTip(event, 'fstips33', 92)">flags</span> <span class="o">:</span> <span class="i" onmouseover="showTip(event, 'fstips34', 93)" onmouseout="hideTip(event, 'fstips34', 93)">BindingFlags</span>) <span class="o">=</span>
<span class="l"> 36: </span>    <span class="k">let</span> <span class="i" onmouseover="showTip(event, 'fstips35', 94)" onmouseout="hideTip(event, 'fstips35', 94)">t</span> <span class="o">=</span> <span class="i" onmouseover="showTip(event, 'fstips27', 95)" onmouseout="hideTip(event, 'fstips27', 95)">getType</span> <span class="i" onmouseover="showTip(event, 'fstips28', 96)" onmouseout="hideTip(event, 'fstips28', 96)">x</span> <span class="k">in</span> <span class="i" onmouseover="showTip(event, 'fstips35', 97)" onmouseout="hideTip(event, 'fstips35', 97)">t</span><span class="o">.</span><span class="i" onmouseover="showTip(event, 'fstips45', 98)" onmouseout="hideTip(event, 'fstips45', 98)">GetMethods</span> <span class="i" onmouseover="showTip(event, 'fstips33', 99)" onmouseout="hideTip(event, 'fstips33', 99)">flags</span>
<span class="l"> 37: </span>    <span class="o">|&gt;</span> <span class="i" onmouseover="showTip(event, 'fstips24', 100)" onmouseout="hideTip(event, 'fstips24', 100)">Seq</span><span class="o">.</span><span class="i" onmouseover="showTip(event, 'fstips25', 101)" onmouseout="hideTip(event, 'fstips25', 101)">map</span> (<span class="k">fun</span> <span class="i" onmouseover="showTip(event, 'fstips46', 102)" onmouseout="hideTip(event, 'fstips46', 102)">x</span> <span class="k">-&gt;</span> <span class="i" onmouseover="showTip(event, 'fstips13', 103)" onmouseout="hideTip(event, 'fstips13', 103)">Methods</span> <span class="i" onmouseover="showTip(event, 'fstips46', 104)" onmouseout="hideTip(event, 'fstips46', 104)">x</span>)
<span class="l"> 38: </span>
<span class="l"> 39: </span>  <span class="k">let</span> <span class="i" onmouseover="showTip(event, 'fstips47', 105)" onmouseout="hideTip(event, 'fstips47', 105)">getConstructors</span> (<span class="i" onmouseover="showTip(event, 'fstips28', 106)" onmouseout="hideTip(event, 'fstips28', 106)">x</span> <span class="o">:</span> <span class="i" onmouseover="showTip(event, 'fstips29', 107)" onmouseout="hideTip(event, 'fstips29', 107)">obj</span>) (<span class="i" onmouseover="showTip(event, 'fstips33', 108)" onmouseout="hideTip(event, 'fstips33', 108)">flags</span> <span class="o">:</span> <span class="i" onmouseover="showTip(event, 'fstips34', 109)" onmouseout="hideTip(event, 'fstips34', 109)">BindingFlags</span>) <span class="o">=</span>
<span class="l"> 40: </span>    <span class="k">let</span> <span class="i" onmouseover="showTip(event, 'fstips35', 110)" onmouseout="hideTip(event, 'fstips35', 110)">t</span> <span class="o">=</span> <span class="i" onmouseover="showTip(event, 'fstips27', 111)" onmouseout="hideTip(event, 'fstips27', 111)">getType</span> <span class="i" onmouseover="showTip(event, 'fstips28', 112)" onmouseout="hideTip(event, 'fstips28', 112)">x</span> <span class="k">in</span> <span class="i" onmouseover="showTip(event, 'fstips35', 113)" onmouseout="hideTip(event, 'fstips35', 113)">t</span><span class="o">.</span><span class="i" onmouseover="showTip(event, 'fstips48', 114)" onmouseout="hideTip(event, 'fstips48', 114)">GetConstructors</span> <span class="i" onmouseover="showTip(event, 'fstips33', 115)" onmouseout="hideTip(event, 'fstips33', 115)">flags</span>
<span class="l"> 41: </span>    <span class="o">|&gt;</span> <span class="i" onmouseover="showTip(event, 'fstips24', 116)" onmouseout="hideTip(event, 'fstips24', 116)">Seq</span><span class="o">.</span><span class="i" onmouseover="showTip(event, 'fstips25', 117)" onmouseout="hideTip(event, 'fstips25', 117)">map</span> (<span class="k">fun</span> <span class="i" onmouseover="showTip(event, 'fstips49', 118)" onmouseout="hideTip(event, 'fstips49', 118)">x</span> <span class="k">-&gt;</span> <span class="i" onmouseover="showTip(event, 'fstips15', 119)" onmouseout="hideTip(event, 'fstips15', 119)">Constructors</span> <span class="i" onmouseover="showTip(event, 'fstips49', 120)" onmouseout="hideTip(event, 'fstips49', 120)">x</span>)
<span class="l"> 42: </span>
<span class="l"> 43: </span>  <span class="k">let</span> <span class="i" onmouseover="showTip(event, 'fstips50', 121)" onmouseout="hideTip(event, 'fstips50', 121)">getMembers</span> <span class="i" onmouseover="showTip(event, 'fstips51', 122)" onmouseout="hideTip(event, 'fstips51', 122)">fflags</span> <span class="i" onmouseover="showTip(event, 'fstips52', 123)" onmouseout="hideTip(event, 'fstips52', 123)">pflags</span> <span class="i" onmouseover="showTip(event, 'fstips53', 124)" onmouseout="hideTip(event, 'fstips53', 124)">eflags</span> <span class="i" onmouseover="showTip(event, 'fstips54', 125)" onmouseout="hideTip(event, 'fstips54', 125)">mflags</span> <span class="i" onmouseover="showTip(event, 'fstips55', 126)" onmouseout="hideTip(event, 'fstips55', 126)">cflags</span> (<span class="i" onmouseover="showTip(event, 'fstips28', 127)" onmouseout="hideTip(event, 'fstips28', 127)">x</span> <span class="o">:</span> <span class="i" onmouseover="showTip(event, 'fstips29', 128)" onmouseout="hideTip(event, 'fstips29', 128)">obj</span>) <span class="o">=</span> <span class="i" onmouseover="showTip(event, 'fstips56', 129)" onmouseout="hideTip(event, 'fstips56', 129)">seq</span> {
<span class="l"> 44: </span>    <span class="k">yield!</span> <span class="i" onmouseover="showTip(event, 'fstips32', 130)" onmouseout="hideTip(event, 'fstips32', 130)">getFields</span>       <span class="i" onmouseover="showTip(event, 'fstips28', 131)" onmouseout="hideTip(event, 'fstips28', 131)">x</span> <span class="i" onmouseover="showTip(event, 'fstips51', 132)" onmouseout="hideTip(event, 'fstips51', 132)">fflags</span>
<span class="l"> 45: </span>    <span class="k">yield!</span> <span class="i" onmouseover="showTip(event, 'fstips38', 133)" onmouseout="hideTip(event, 'fstips38', 133)">getProperties</span>   <span class="i" onmouseover="showTip(event, 'fstips28', 134)" onmouseout="hideTip(event, 'fstips28', 134)">x</span> <span class="i" onmouseover="showTip(event, 'fstips52', 135)" onmouseout="hideTip(event, 'fstips52', 135)">pflags</span>
<span class="l"> 46: </span>    <span class="k">yield!</span> <span class="i" onmouseover="showTip(event, 'fstips41', 136)" onmouseout="hideTip(event, 'fstips41', 136)">getEvents</span>       <span class="i" onmouseover="showTip(event, 'fstips28', 137)" onmouseout="hideTip(event, 'fstips28', 137)">x</span> <span class="i" onmouseover="showTip(event, 'fstips53', 138)" onmouseout="hideTip(event, 'fstips53', 138)">eflags</span>
<span class="l"> 47: </span>    <span class="k">yield!</span> <span class="i" onmouseover="showTip(event, 'fstips44', 139)" onmouseout="hideTip(event, 'fstips44', 139)">getMethods</span>      <span class="i" onmouseover="showTip(event, 'fstips28', 140)" onmouseout="hideTip(event, 'fstips28', 140)">x</span> <span class="i" onmouseover="showTip(event, 'fstips54', 141)" onmouseout="hideTip(event, 'fstips54', 141)">mflags</span>
<span class="l"> 48: </span>    <span class="k">yield!</span> <span class="i" onmouseover="showTip(event, 'fstips47', 142)" onmouseout="hideTip(event, 'fstips47', 142)">getConstructors</span> <span class="i" onmouseover="showTip(event, 'fstips28', 143)" onmouseout="hideTip(event, 'fstips28', 143)">x</span> <span class="i" onmouseover="showTip(event, 'fstips55', 144)" onmouseout="hideTip(event, 'fstips55', 144)">cflags</span> }
<span class="l"> 49: </span>
<span class="l"> 50: </span><span class="c">//</span><span class="c"> </span><span class="c">I</span><span class="c"> </span><span class="c">don't</span><span class="c"> </span><span class="c">want</span><span class="c"> </span><span class="c">to</span><span class="c"> </span><span class="c">type</span><span class="c"> </span><span class="c">these</span><span class="c"> </span><span class="c">over</span><span class="c"> </span><span class="c">and</span><span class="c"> </span><span class="c">over</span><span class="c"> </span><span class="c">again</span>
<span class="l"> 51: </span><span class="k">let</span> <span class="i" onmouseover="showTip(event, 'fstips57', 145)" onmouseout="hideTip(event, 'fstips57', 145)">Static</span> <span class="o">=</span> 
<span class="l"> 52: </span>  (   <span class="i" onmouseover="showTip(event, 'fstips34', 146)" onmouseout="hideTip(event, 'fstips34', 146)">BindingFlags</span><span class="o">.</span><span class="i" onmouseover="showTip(event, 'fstips58', 147)" onmouseout="hideTip(event, 'fstips58', 147)">Static</span>   
<span class="l"> 53: </span>  <span class="o">|||</span> <span class="i" onmouseover="showTip(event, 'fstips34', 148)" onmouseout="hideTip(event, 'fstips34', 148)">BindingFlags</span><span class="o">.</span><span class="i" onmouseover="showTip(event, 'fstips59', 149)" onmouseout="hideTip(event, 'fstips59', 149)">NonPublic</span> 
<span class="l"> 54: </span>  <span class="o">|||</span> <span class="i" onmouseover="showTip(event, 'fstips34', 150)" onmouseout="hideTip(event, 'fstips34', 150)">BindingFlags</span><span class="o">.</span><span class="i" onmouseover="showTip(event, 'fstips60', 151)" onmouseout="hideTip(event, 'fstips60', 151)">Public</span>)
<span class="l"> 55: </span><span class="k">let</span> <span class="i" onmouseover="showTip(event, 'fstips61', 152)" onmouseout="hideTip(event, 'fstips61', 152)">Instance</span> <span class="o">=</span> 
<span class="l"> 56: </span>  (   <span class="i" onmouseover="showTip(event, 'fstips34', 153)" onmouseout="hideTip(event, 'fstips34', 153)">BindingFlags</span><span class="o">.</span><span class="i" onmouseover="showTip(event, 'fstips62', 154)" onmouseout="hideTip(event, 'fstips62', 154)">Instance</span> 
<span class="l"> 57: </span>  <span class="o">|||</span> <span class="i" onmouseover="showTip(event, 'fstips34', 155)" onmouseout="hideTip(event, 'fstips34', 155)">BindingFlags</span><span class="o">.</span><span class="i" onmouseover="showTip(event, 'fstips59', 156)" onmouseout="hideTip(event, 'fstips59', 156)">NonPublic</span> 
<span class="l"> 58: </span>  <span class="o">|||</span> <span class="i" onmouseover="showTip(event, 'fstips34', 157)" onmouseout="hideTip(event, 'fstips34', 157)">BindingFlags</span><span class="o">.</span><span class="i" onmouseover="showTip(event, 'fstips60', 158)" onmouseout="hideTip(event, 'fstips60', 158)">Public</span>)
<span class="l"> 59: </span><span class="k">let</span> <span class="i" onmouseover="showTip(event, 'fstips63', 159)" onmouseout="hideTip(event, 'fstips63', 159)">All</span> <span class="o">=</span> 
<span class="l"> 60: </span>  (   <span class="i" onmouseover="showTip(event, 'fstips34', 160)" onmouseout="hideTip(event, 'fstips34', 160)">BindingFlags</span><span class="o">.</span><span class="i" onmouseover="showTip(event, 'fstips58', 161)" onmouseout="hideTip(event, 'fstips58', 161)">Static</span>   
<span class="l"> 61: </span>  <span class="o">|||</span> <span class="i" onmouseover="showTip(event, 'fstips34', 162)" onmouseout="hideTip(event, 'fstips34', 162)">BindingFlags</span><span class="o">.</span><span class="i" onmouseover="showTip(event, 'fstips62', 163)" onmouseout="hideTip(event, 'fstips62', 163)">Instance</span>  
<span class="l"> 62: </span>  <span class="o">|||</span> <span class="i" onmouseover="showTip(event, 'fstips34', 164)" onmouseout="hideTip(event, 'fstips34', 164)">BindingFlags</span><span class="o">.</span><span class="i" onmouseover="showTip(event, 'fstips59', 165)" onmouseout="hideTip(event, 'fstips59', 165)">NonPublic</span> 
<span class="l"> 63: </span>  <span class="o">|||</span> <span class="i" onmouseover="showTip(event, 'fstips34', 166)" onmouseout="hideTip(event, 'fstips34', 166)">BindingFlags</span><span class="o">.</span><span class="i" onmouseover="showTip(event, 'fstips60', 167)" onmouseout="hideTip(event, 'fstips60', 167)">Public</span>)
<span class="l"> 64: </span>
<span class="l"> 65: </span><span class="c">//</span><span class="c"> </span><span class="c">A</span><span class="c"> </span><span class="c">sequence</span><span class="c"> </span><span class="c">of</span><span class="c"> </span><span class="c">types</span><span class="c"> </span><span class="c">from</span><span class="c"> </span><span class="c">FSharp.Core.dll</span>
<span class="l"> 66: </span><span class="k">let</span> <span class="i" onmouseover="showTip(event, 'fstips64', 168)" onmouseout="hideTip(event, 'fstips64', 168)">fscore</span> <span class="o">=</span> 
<span class="l"> 67: </span>  <span class="i" onmouseover="showTip(event, 'fstips65', 169)" onmouseout="hideTip(event, 'fstips65', 169)">Reflect</span><span class="o">.</span><span class="i" onmouseover="showTip(event, 'fstips66', 170)" onmouseout="hideTip(event, 'fstips66', 170)">getTypes</span> (<span class="s">@"</span><span class="s">C</span><span class="s">:</span><span class="s">\</span><span class="s">Program</span><span class="s"> </span><span class="s">Files</span><span class="s"> </span><span class="s">(</span><span class="s">x86</span><span class="s">)</span><span class="s">\</span><span class="s">FSharp</span><span class="s">-</span><span class="s">2</span><span class="s">.</span><span class="s">0</span><span class="s">.</span><span class="s">0</span><span class="s">.</span><span class="s">0</span><span class="s">\</span><span class="s">bin</span><span class="s">\</span><span class="s">FSharp</span><span class="s">.</span><span class="s">Core</span><span class="s">.</span><span class="s">dll</span><span class="s">"</span>)
<span class="l"> 68: </span>
<span class="l"> 69: </span><span class="c">//</span><span class="c"> </span><span class="c">Printing</span><span class="c"> </span><span class="c">all</span><span class="c"> </span><span class="c">members</span>
<span class="l"> 70: </span><span class="i" onmouseover="showTip(event, 'fstips64', 171)" onmouseout="hideTip(event, 'fstips64', 171)">fscore</span>
<span class="l"> 71: </span><span class="o">|&gt;</span> <span class="i" onmouseover="showTip(event, 'fstips24', 172)" onmouseout="hideTip(event, 'fstips24', 172)">Seq</span><span class="o">.</span><span class="i" onmouseover="showTip(event, 'fstips25', 173)" onmouseout="hideTip(event, 'fstips25', 173)">map</span>(<span class="k">fun</span> <span class="i" onmouseover="showTip(event, 'fstips67', 174)" onmouseout="hideTip(event, 'fstips67', 174)">x</span> <span class="k">-&gt;</span>
<span class="l"> 72: </span>  <span class="k">match</span> <span class="i" onmouseover="showTip(event, 'fstips67', 175)" onmouseout="hideTip(event, 'fstips67', 175)">x</span> <span class="k">with</span>
<span class="l"> 73: </span>  | <span class="i" onmouseover="showTip(event, 'fstips65', 176)" onmouseout="hideTip(event, 'fstips65', 176)">Reflect</span><span class="o">.</span><span class="i" onmouseover="showTip(event, 'fstips68', 177)" onmouseout="hideTip(event, 'fstips68', 177)">Types</span> <span class="i" onmouseover="showTip(event, 'fstips26', 178)" onmouseout="hideTip(event, 'fstips26', 178)">x</span> <span class="k">-&gt;</span> (<span class="i" onmouseover="showTip(event, 'fstips65', 179)" onmouseout="hideTip(event, 'fstips65', 179)">Reflect</span><span class="o">.</span><span class="i" onmouseover="showTip(event, 'fstips69', 180)" onmouseout="hideTip(event, 'fstips69', 180)">getMembers</span> <span class="i" onmouseover="showTip(event, 'fstips63', 181)" onmouseout="hideTip(event, 'fstips63', 181)">All</span> <span class="i" onmouseover="showTip(event, 'fstips63', 182)" onmouseout="hideTip(event, 'fstips63', 182)">All</span> <span class="i" onmouseover="showTip(event, 'fstips63', 183)" onmouseout="hideTip(event, 'fstips63', 183)">All</span> <span class="i" onmouseover="showTip(event, 'fstips63', 184)" onmouseout="hideTip(event, 'fstips63', 184)">All</span> <span class="i" onmouseover="showTip(event, 'fstips63', 185)" onmouseout="hideTip(event, 'fstips63', 185)">All</span> <span class="i" onmouseover="showTip(event, 'fstips26', 186)" onmouseout="hideTip(event, 'fstips26', 186)">x</span>),(<span class="i" onmouseover="showTip(event, 'fstips26', 187)" onmouseout="hideTip(event, 'fstips26', 187)">x</span><span class="o">.</span><span class="i" onmouseover="showTip(event, 'fstips70', 188)" onmouseout="hideTip(event, 'fstips70', 188)">Name</span>)
<span class="l"> 74: </span>  | _ <span class="k">-&gt;</span> <span class="i" onmouseover="showTip(event, 'fstips71', 189)" onmouseout="hideTip(event, 'fstips71', 189)">failwith</span> <span class="s">"</span><span class="s">wrong</span><span class="s"> </span><span class="s">type</span><span class="s">"</span>)
<span class="l"> 75: </span><span class="o">|&gt;</span> <span class="i" onmouseover="showTip(event, 'fstips24', 190)" onmouseout="hideTip(event, 'fstips24', 190)">Seq</span><span class="o">.</span><span class="i" onmouseover="showTip(event, 'fstips72', 191)" onmouseout="hideTip(event, 'fstips72', 191)">iter</span> (<span class="k">fun</span> (<span class="i" onmouseover="showTip(event, 'fstips73', 192)" onmouseout="hideTip(event, 'fstips73', 192)">x</span>,<span class="i" onmouseover="showTip(event, 'fstips74', 193)" onmouseout="hideTip(event, 'fstips74', 193)">y</span>) <span class="k">-&gt;</span>
<span class="l"> 76: </span>  <span class="i" onmouseover="showTip(event, 'fstips24', 194)" onmouseout="hideTip(event, 'fstips24', 194)">Seq</span><span class="o">.</span><span class="i" onmouseover="showTip(event, 'fstips72', 195)" onmouseout="hideTip(event, 'fstips72', 195)">iter</span> (<span class="k">fun</span> <span class="i" onmouseover="showTip(event, 'fstips67', 196)" onmouseout="hideTip(event, 'fstips67', 196)">x</span> <span class="k">-&gt;</span>
<span class="l"> 77: </span>    <span class="k">match</span> <span class="i" onmouseover="showTip(event, 'fstips67', 197)" onmouseout="hideTip(event, 'fstips67', 197)">x</span> <span class="k">with</span>
<span class="l"> 78: </span>    | <span class="i" onmouseover="showTip(event, 'fstips65', 198)" onmouseout="hideTip(event, 'fstips65', 198)">Reflect</span><span class="o">.</span><span class="i" onmouseover="showTip(event, 'fstips68', 199)" onmouseout="hideTip(event, 'fstips68', 199)">Types</span>        <span class="i" onmouseover="showTip(event, 'fstips26', 200)" onmouseout="hideTip(event, 'fstips26', 200)">x</span> <span class="k">-&gt;</span> <span class="i" onmouseover="showTip(event, 'fstips75', 201)" onmouseout="hideTip(event, 'fstips75', 201)">printfn</span> <span class="s">"</span><span class="s">%</span><span class="s">s</span><span class="s">\t</span><span class="s">Type</span><span class="s">:</span><span class="s"> </span><span class="s">%</span><span class="s">s</span><span class="s">"</span>        <span class="i" onmouseover="showTip(event, 'fstips74', 202)" onmouseout="hideTip(event, 'fstips74', 202)">y</span> <span class="o">&lt;|</span> <span class="i" onmouseover="showTip(event, 'fstips26', 203)" onmouseout="hideTip(event, 'fstips26', 203)">x</span><span class="o">.</span><span class="i" onmouseover="showTip(event, 'fstips70', 204)" onmouseout="hideTip(event, 'fstips70', 204)">Name</span>
<span class="l"> 79: </span>    | <span class="i" onmouseover="showTip(event, 'fstips65', 205)" onmouseout="hideTip(event, 'fstips65', 205)">Reflect</span><span class="o">.</span><span class="i" onmouseover="showTip(event, 'fstips76', 206)" onmouseout="hideTip(event, 'fstips76', 206)">Fields</span>       <span class="i" onmouseover="showTip(event, 'fstips37', 207)" onmouseout="hideTip(event, 'fstips37', 207)">x</span> <span class="k">-&gt;</span> <span class="i" onmouseover="showTip(event, 'fstips75', 208)" onmouseout="hideTip(event, 'fstips75', 208)">printfn</span> <span class="s">"</span><span class="s">%</span><span class="s">s</span><span class="s">\t</span><span class="s">Field</span><span class="s">:</span><span class="s"> </span><span class="s">%</span><span class="s">s</span><span class="s">"</span>       <span class="i" onmouseover="showTip(event, 'fstips74', 209)" onmouseout="hideTip(event, 'fstips74', 209)">y</span> <span class="o">&lt;|</span> <span class="i" onmouseover="showTip(event, 'fstips37', 210)" onmouseout="hideTip(event, 'fstips37', 210)">x</span><span class="o">.</span><span class="i" onmouseover="showTip(event, 'fstips70', 211)" onmouseout="hideTip(event, 'fstips70', 211)">Name</span>
<span class="l"> 80: </span>    | <span class="i" onmouseover="showTip(event, 'fstips65', 212)" onmouseout="hideTip(event, 'fstips65', 212)">Reflect</span><span class="o">.</span><span class="i" onmouseover="showTip(event, 'fstips77', 213)" onmouseout="hideTip(event, 'fstips77', 213)">Properties</span>   <span class="i" onmouseover="showTip(event, 'fstips40', 214)" onmouseout="hideTip(event, 'fstips40', 214)">x</span> <span class="k">-&gt;</span> <span class="i" onmouseover="showTip(event, 'fstips75', 215)" onmouseout="hideTip(event, 'fstips75', 215)">printfn</span> <span class="s">"</span><span class="s">%</span><span class="s">s</span><span class="s">\t</span><span class="s">Property</span><span class="s">:</span><span class="s"> </span><span class="s">%</span><span class="s">s</span><span class="s">"</span>    <span class="i" onmouseover="showTip(event, 'fstips74', 216)" onmouseout="hideTip(event, 'fstips74', 216)">y</span> <span class="o">&lt;|</span> <span class="i" onmouseover="showTip(event, 'fstips40', 217)" onmouseout="hideTip(event, 'fstips40', 217)">x</span><span class="o">.</span><span class="i" onmouseover="showTip(event, 'fstips70', 218)" onmouseout="hideTip(event, 'fstips70', 218)">Name</span>
<span class="l"> 81: </span>    | <span class="i" onmouseover="showTip(event, 'fstips65', 219)" onmouseout="hideTip(event, 'fstips65', 219)">Reflect</span><span class="o">.</span><span class="i" onmouseover="showTip(event, 'fstips78', 220)" onmouseout="hideTip(event, 'fstips78', 220)">Events</span>       <span class="i" onmouseover="showTip(event, 'fstips43', 221)" onmouseout="hideTip(event, 'fstips43', 221)">x</span> <span class="k">-&gt;</span> <span class="i" onmouseover="showTip(event, 'fstips75', 222)" onmouseout="hideTip(event, 'fstips75', 222)">printfn</span> <span class="s">"</span><span class="s">%</span><span class="s">s</span><span class="s">\t</span><span class="s">Event</span><span class="s">:</span><span class="s"> </span><span class="s">%</span><span class="s">s</span><span class="s">"</span>       <span class="i" onmouseover="showTip(event, 'fstips74', 223)" onmouseout="hideTip(event, 'fstips74', 223)">y</span> <span class="o">&lt;|</span> <span class="i" onmouseover="showTip(event, 'fstips43', 224)" onmouseout="hideTip(event, 'fstips43', 224)">x</span><span class="o">.</span><span class="i" onmouseover="showTip(event, 'fstips70', 225)" onmouseout="hideTip(event, 'fstips70', 225)">Name</span>
<span class="l"> 82: </span>    | <span class="i" onmouseover="showTip(event, 'fstips65', 226)" onmouseout="hideTip(event, 'fstips65', 226)">Reflect</span><span class="o">.</span><span class="i" onmouseover="showTip(event, 'fstips79', 227)" onmouseout="hideTip(event, 'fstips79', 227)">Methods</span>      <span class="i" onmouseover="showTip(event, 'fstips46', 228)" onmouseout="hideTip(event, 'fstips46', 228)">x</span> <span class="k">-&gt;</span> <span class="i" onmouseover="showTip(event, 'fstips75', 229)" onmouseout="hideTip(event, 'fstips75', 229)">printfn</span> <span class="s">"</span><span class="s">%</span><span class="s">s</span><span class="s">\t</span><span class="s">Method</span><span class="s">:</span><span class="s"> </span><span class="s">%</span><span class="s">s</span><span class="s">"</span>      <span class="i" onmouseover="showTip(event, 'fstips74', 230)" onmouseout="hideTip(event, 'fstips74', 230)">y</span> <span class="o">&lt;|</span> <span class="i" onmouseover="showTip(event, 'fstips46', 231)" onmouseout="hideTip(event, 'fstips46', 231)">x</span><span class="o">.</span><span class="i" onmouseover="showTip(event, 'fstips70', 232)" onmouseout="hideTip(event, 'fstips70', 232)">Name</span>
<span class="l"> 83: </span>    | <span class="i" onmouseover="showTip(event, 'fstips65', 233)" onmouseout="hideTip(event, 'fstips65', 233)">Reflect</span><span class="o">.</span><span class="i" onmouseover="showTip(event, 'fstips80', 234)" onmouseout="hideTip(event, 'fstips80', 234)">Constructors</span> <span class="i" onmouseover="showTip(event, 'fstips49', 235)" onmouseout="hideTip(event, 'fstips49', 235)">x</span> <span class="k">-&gt;</span> <span class="i" onmouseover="showTip(event, 'fstips75', 236)" onmouseout="hideTip(event, 'fstips75', 236)">printfn</span> <span class="s">"</span><span class="s">%</span><span class="s">s</span><span class="s">\t</span><span class="s">Constructor</span><span class="s">:</span><span class="s"> </span><span class="s">%</span><span class="s">s</span><span class="s">"</span> <span class="i" onmouseover="showTip(event, 'fstips74', 237)" onmouseout="hideTip(event, 'fstips74', 237)">y</span> <span class="o">&lt;|</span> <span class="i" onmouseover="showTip(event, 'fstips49', 238)" onmouseout="hideTip(event, 'fstips49', 238)">x</span><span class="o">.</span><span class="i" onmouseover="showTip(event, 'fstips70', 239)" onmouseout="hideTip(event, 'fstips70', 239)">Name</span>) <span class="i" onmouseover="showTip(event, 'fstips73', 240)" onmouseout="hideTip(event, 'fstips73', 240)">x</span> )</pre>
</p>
<p/>
That should keep your FSI busy for a moment while you read the rest of this post.  It’s not a secret that there are quite a few types available to us in .NET and we get a handful or two more when we reference FSharp.Core.dll.  A type is just data, and alone it is boring if not a bit useless.  Here’s the interesting part though:  In F#, functions are types.  These function types are still data.  To do something interesting, all we need is to give a function some data, and it gives us some new data in return. The data we give to our function can be an Object(s) and/or another function(s), as both are just data.</p>
<p/>
F# is a functional programming language.  When we say ‘functional’ we are talking about a <a href="http://blog.thinkhard.net/wp-content/plugins/wordpress-feed-statistics/feed-statistics.php?url=aHR0cDovL2VuLndpa2lwZWRpYS5vcmcvd2lraS9GdW5jdGlvbl8oY29tcHV0ZXJfc2NpZW5jZSk=">Function (computer science)</a> as much as we’re talking about a <a href="http://blog.thinkhard.net/wp-content/plugins/wordpress-feed-statistics/feed-statistics.php?url=aHR0cDovL2VuLndpa2lwZWRpYS5vcmcvd2lraS9GdW5jdGlvbl8obWF0aGVtYXRpY3Mp">Function (mathematics)</a>.   A function in F# straddles these two definitions quite nicely.  No doubt you are familiar with the computer science definition of a Function / Method / Procedure / Subroutine.  For this reason I want you to fearlessly broach the mathematical side of F# functions.  Or, if you are mathematically inclined but haven&#8217;t used F# for mathematical programming&#8230; Have a look.</p>
<p/>
Let’s take a short look at the “anatomy” of an F# function.  Really, this isn’t going to be mathematically rigorous.  I’m not a mathematician, I’m a programmer.  I’m not patient enough to do any hand holding throughout, so I’m just going to show you (unless you already know) the names for things so when we bring them up in later posts (about Gang of Four OOP Design Patterns from the perspective of Functional Programing) we won’t have to stop and explain what they mean.</p>
<p/>

<pre class="fssnip"><span class="l"> 84: </span><span class="c">//</span><span class="c"> </span><span class="c">Function</span>
<span class="l"> 85: </span><span class="k">let</span> <span class="i" onmouseover="showTip(event, 'fstips81', 241)" onmouseout="hideTip(event, 'fstips81', 241)">sum</span>   <span class="i" onmouseover="showTip(event, 'fstips82', 242)" onmouseout="hideTip(event, 'fstips82', 242)">a</span> <span class="i" onmouseover="showTip(event, 'fstips83', 243)" onmouseout="hideTip(event, 'fstips83', 243)">b</span> <span class="o">=</span> <span class="i" onmouseover="showTip(event, 'fstips82', 244)" onmouseout="hideTip(event, 'fstips82', 244)">a</span> <span class="o">+</span> <span class="i" onmouseover="showTip(event, 'fstips83', 245)" onmouseout="hideTip(event, 'fstips83', 245)">b</span>   <span class="c">//</span><span class="c"> </span><span class="c">val</span><span class="c"> </span><span class="c">add</span><span class="c">   </span><span class="c">:</span><span class="c"> </span><span class="c">int</span><span class="c"> </span><span class="c">-&gt;</span><span class="c"> </span><span class="c">int</span><span class="c"> </span><span class="c">-&gt;</span><span class="c"> </span><span class="c">int</span>
<span class="l"> 86: </span><span class="k">let</span> <span class="i" onmouseover="showTip(event, 'fstips84', 246)" onmouseout="hideTip(event, 'fstips84', 246)">mul</span>   <span class="i" onmouseover="showTip(event, 'fstips82', 247)" onmouseout="hideTip(event, 'fstips82', 247)">a</span> <span class="i" onmouseover="showTip(event, 'fstips83', 248)" onmouseout="hideTip(event, 'fstips83', 248)">b</span> <span class="o">=</span> <span class="i" onmouseover="showTip(event, 'fstips82', 249)" onmouseout="hideTip(event, 'fstips82', 249)">a</span> <span class="o">*</span> <span class="i" onmouseover="showTip(event, 'fstips83', 250)" onmouseout="hideTip(event, 'fstips83', 250)">b</span>   <span class="c">//</span><span class="c"> </span><span class="c">val</span><span class="c"> </span><span class="c">mul</span><span class="c">   </span><span class="c">:</span><span class="c"> </span><span class="c">int</span><span class="c"> </span><span class="c">-&gt;</span><span class="c"> </span><span class="c">int</span><span class="c"> </span><span class="c">-&gt;</span><span class="c"> </span><span class="c">int</span>
<span class="l"> 87: </span><span class="k">let</span> <span class="i" onmouseover="showTip(event, 'fstips85', 251)" onmouseout="hideTip(event, 'fstips85', 251)">sqr</span>   <span class="i" onmouseover="showTip(event, 'fstips86', 252)" onmouseout="hideTip(event, 'fstips86', 252)">n</span>   <span class="o">=</span> <span class="i" onmouseover="showTip(event, 'fstips84', 253)" onmouseout="hideTip(event, 'fstips84', 253)">mul</span> <span class="i" onmouseover="showTip(event, 'fstips86', 254)" onmouseout="hideTip(event, 'fstips86', 254)">n</span> <span class="i" onmouseover="showTip(event, 'fstips86', 255)" onmouseout="hideTip(event, 'fstips86', 255)">n</span> <span class="c">//</span><span class="c"> </span><span class="c">val</span><span class="c"> </span><span class="c">sqr</span><span class="c">   </span><span class="c">:</span><span class="c"> </span><span class="c">int</span><span class="c"> </span><span class="c">-&gt;</span><span class="c"> </span><span class="c">int</span></pre>
</p>
<p/>
A function relates each element of a “set” with exactly one element of another “set”, which could possibly be the same “set”.  Maybe, as programmers, we can get away with saying “class”.  I think you will also find that the term ‘relates’ is more useful in the long run over a word like ‘transforms’, at least until later on&#8230;</p>
<p/>
There is a kind of notation we can use to reason about the type of a function in F#.  It is called arrow notation.  It is easy to read, and after a few exercises and expanding our vocabulary a little it becomes pretty easy to manipulate.  To show this off I’m going to need a function that takes a lot of parameters.   <a href="http://blog.thinkhard.net/wp-content/plugins/wordpress-feed-statistics/feed-statistics.php?url=aHR0cDovL3d3dy55b3V0dWJlLmNvbS93YXRjaD92PVBfRV9adFJaMXlr">Are you familiar with the Drake equation?</a> (<a href="http://blog.thinkhard.net/wp-content/plugins/wordpress-feed-statistics/feed-statistics.php?url=aHR0cDovL3d3dy55b3V0dWJlLmNvbS93YXRjaD92PTJfVTdQN2ZrUEJZ">a more informative and animated infographic</a> is just as entertaining to watch)</p>
<p/>

<pre class="fssnip"><span class="l"> 88: </span><span class="c">//</span><span class="c"> </span><span class="c">functions</span><span class="c"> </span><span class="c">are</span><span class="c"> </span><span class="c">actually</span><span class="c"> </span><span class="c">curried</span>
<span class="l"> 89: </span><span class="k">let</span> <span class="i" onmouseover="showTip(event, 'fstips87', 256)" onmouseout="hideTip(event, 'fstips87', 256)">drakeEq</span> <span class="i" onmouseover="showTip(event, 'fstips88', 257)" onmouseout="hideTip(event, 'fstips88', 257)">R</span> <span class="i" onmouseover="showTip(event, 'fstips89', 258)" onmouseout="hideTip(event, 'fstips89', 258)">fp</span> <span class="i" onmouseover="showTip(event, 'fstips90', 259)" onmouseout="hideTip(event, 'fstips90', 259)">ne</span> <span class="i" onmouseover="showTip(event, 'fstips91', 260)" onmouseout="hideTip(event, 'fstips91', 260)">fl</span> <span class="i" onmouseover="showTip(event, 'fstips92', 261)" onmouseout="hideTip(event, 'fstips92', 261)">fi</span> <span class="i" onmouseover="showTip(event, 'fstips93', 262)" onmouseout="hideTip(event, 'fstips93', 262)">fc</span> <span class="i" onmouseover="showTip(event, 'fstips94', 263)" onmouseout="hideTip(event, 'fstips94', 263)">L</span> <span class="o">:</span> <span class="i" onmouseover="showTip(event, 'fstips95', 264)" onmouseout="hideTip(event, 'fstips95', 264)">float</span> <span class="o">=</span> 
<span class="l"> 90: </span>  (<span class="i" onmouseover="showTip(event, 'fstips95', 265)" onmouseout="hideTip(event, 'fstips95', 265)">float</span> <span class="i" onmouseover="showTip(event, 'fstips96', 266)" onmouseout="hideTip(event, 'fstips96', 266)">R</span>) <span class="o">*</span> <span class="i" onmouseover="showTip(event, 'fstips89', 267)" onmouseout="hideTip(event, 'fstips89', 267)">fp</span> <span class="o">*</span> <span class="i" onmouseover="showTip(event, 'fstips90', 268)" onmouseout="hideTip(event, 'fstips90', 268)">ne</span> <span class="o">*</span> <span class="i" onmouseover="showTip(event, 'fstips91', 269)" onmouseout="hideTip(event, 'fstips91', 269)">fl</span> <span class="o">*</span> <span class="i" onmouseover="showTip(event, 'fstips92', 270)" onmouseout="hideTip(event, 'fstips92', 270)">fi</span> <span class="o">*</span> <span class="i" onmouseover="showTip(event, 'fstips93', 271)" onmouseout="hideTip(event, 'fstips93', 271)">fc</span> <span class="o">*</span> (<span class="i" onmouseover="showTip(event, 'fstips95', 272)" onmouseout="hideTip(event, 'fstips95', 272)">float</span> <span class="i" onmouseover="showTip(event, 'fstips97', 273)" onmouseout="hideTip(event, 'fstips97', 273)">L</span>)</pre>
</p>
<p/>
There are a lot of Objects and Arrows in this particular function’s signature.  Good, because I want to show you what a curried function actually means.  Place your mouse cursor over the function name drakeEq on line 89 and observe the signature:</p>
<p/>
\(drakeEq : int \rightarrow float \rightarrow float \rightarrow float \rightarrow float \rightarrow int \rightarrow float\)</p>
<p/>
This arrow notation may seem arcane to you, but it is necessary due to the fact that function parameters are implicitly curried.  This signature corresponds with the lambda beginning at line 92 and ending at line 98. This arrow notation may seem arcane to you, but it is extremely helpful in F# due to the fact that function parameters are implicitly curried.  You can use this feature of F# to construct higher order functions.  You can pick-apart the parameters and wedge functions into them as long as the algebraic type signatures line up.  Here’s how you read that signature:  drakeEq is a function that takes an int and a float and a float and a float and a float and an int and returns a float.  When reading function signatures, the last type to appear is the type being returned by the function. Any functions taking other functions as parameters will express that in their type signatures by surrounding the input function with parenthesis. For the drakeEq, though, here is what is (sort of) happening behind the scenes:</p>
<p/>

<pre class="fssnip"><span class="l"> 91: </span><span class="c">//</span><span class="c"> </span><span class="c">like</span><span class="c"> </span><span class="c">this:</span>
<span class="l"> 92: </span>(<span class="k">fun</span> (<span class="i" onmouseover="showTip(event, 'fstips88', 274)" onmouseout="hideTip(event, 'fstips88', 274)">R</span>  <span class="o">:</span> <span class="i" onmouseover="showTip(event, 'fstips98', 275)" onmouseout="hideTip(event, 'fstips98', 275)">int</span>  ) <span class="k">-&gt;</span>
<span class="l"> 93: </span> (<span class="k">fun</span> (<span class="i" onmouseover="showTip(event, 'fstips89', 276)" onmouseout="hideTip(event, 'fstips89', 276)">fp</span> <span class="o">:</span> <span class="i" onmouseover="showTip(event, 'fstips95', 277)" onmouseout="hideTip(event, 'fstips95', 277)">float</span>) <span class="k">-&gt;</span>
<span class="l"> 94: </span>  (<span class="k">fun</span> (<span class="i" onmouseover="showTip(event, 'fstips90', 278)" onmouseout="hideTip(event, 'fstips90', 278)">ne</span> <span class="o">:</span> <span class="i" onmouseover="showTip(event, 'fstips95', 279)" onmouseout="hideTip(event, 'fstips95', 279)">float</span>) <span class="k">-&gt;</span>
<span class="l"> 95: </span>   (<span class="k">fun</span> (<span class="i" onmouseover="showTip(event, 'fstips91', 280)" onmouseout="hideTip(event, 'fstips91', 280)">fl</span> <span class="o">:</span> <span class="i" onmouseover="showTip(event, 'fstips95', 281)" onmouseout="hideTip(event, 'fstips95', 281)">float</span>) <span class="k">-&gt;</span>
<span class="l"> 96: </span>    (<span class="k">fun</span> (<span class="i" onmouseover="showTip(event, 'fstips92', 282)" onmouseout="hideTip(event, 'fstips92', 282)">fi</span> <span class="o">:</span> <span class="i" onmouseover="showTip(event, 'fstips95', 283)" onmouseout="hideTip(event, 'fstips95', 283)">float</span>) <span class="k">-&gt;</span>
<span class="l"> 97: </span>     (<span class="k">fun</span> (<span class="i" onmouseover="showTip(event, 'fstips93', 284)" onmouseout="hideTip(event, 'fstips93', 284)">fc</span> <span class="o">:</span> <span class="i" onmouseover="showTip(event, 'fstips95', 285)" onmouseout="hideTip(event, 'fstips95', 285)">float</span>) <span class="k">-&gt;</span>
<span class="l"> 98: </span>      (<span class="k">fun</span> (<span class="i" onmouseover="showTip(event, 'fstips94', 286)" onmouseout="hideTip(event, 'fstips94', 286)">L</span>  <span class="o">:</span> <span class="i" onmouseover="showTip(event, 'fstips98', 287)" onmouseout="hideTip(event, 'fstips98', 287)">int</span>  ) <span class="k">-&gt;</span> (<span class="i" onmouseover="showTip(event, 'fstips95', 288)" onmouseout="hideTip(event, 'fstips95', 288)">float</span> <span class="i" onmouseover="showTip(event, 'fstips96', 289)" onmouseout="hideTip(event, 'fstips96', 289)">R</span>) <span class="o">*</span> <span class="i" onmouseover="showTip(event, 'fstips89', 290)" onmouseout="hideTip(event, 'fstips89', 290)">fp</span> <span class="o">*</span> <span class="i" onmouseover="showTip(event, 'fstips90', 291)" onmouseout="hideTip(event, 'fstips90', 291)">ne</span> <span class="o">*</span> <span class="i" onmouseover="showTip(event, 'fstips91', 292)" onmouseout="hideTip(event, 'fstips91', 292)">fl</span> <span class="o">*</span> <span class="i" onmouseover="showTip(event, 'fstips92', 293)" onmouseout="hideTip(event, 'fstips92', 293)">fi</span> <span class="o">*</span> <span class="i" onmouseover="showTip(event, 'fstips93', 294)" onmouseout="hideTip(event, 'fstips93', 294)">fc</span> <span class="o">*</span> (<span class="i" onmouseover="showTip(event, 'fstips95', 295)" onmouseout="hideTip(event, 'fstips95', 295)">float</span> <span class="i" onmouseover="showTip(event, 'fstips97', 296)" onmouseout="hideTip(event, 'fstips97', 296)">L</span>))))))))</pre>
</p>
<p/>
Hmm…  This looks like a bunch of nested lambda expressions.  In fact, all but the outer-most of these anonymous functions is wrapped by an outer lambda.  This has the same recursive structure as a Linked List does, with the exception that the input values to each one of the lambdas have closure in the nested lambdas.</p>
<p/>

<pre class="fssnip"><span class="l"> 99: </span><span class="c">//</span><span class="c"> </span><span class="c">recursive</span><span class="c"> </span><span class="c">data</span><span class="c"> </span><span class="c">type</span>
<span class="l">100: </span><span class="k">type</span> <span class="o">'</span><span class="i">a</span> <span class="i" onmouseover="showTip(event, 'fstips99', 297)" onmouseout="hideTip(event, 'fstips99', 297)">LinkedList</span> <span class="o">=</span>
<span class="l">101: </span>  | <span class="i" onmouseover="showTip(event, 'fstips100', 298)" onmouseout="hideTip(event, 'fstips100', 298)">Empty</span>                                  <span class="c">//</span><span class="c"> </span><span class="c">aka:</span><span class="c"> </span><span class="c">nil</span>
<span class="l">102: </span>  | <span class="i" onmouseover="showTip(event, 'fstips101', 299)" onmouseout="hideTip(event, 'fstips101', 299)">Element</span> <span class="k">of</span>    <span class="o">'</span><span class="i">a</span>      <span class="o">*</span> <span class="o">'</span><span class="i">a</span> <span class="i" onmouseover="showTip(event, 'fstips99', 300)" onmouseout="hideTip(event, 'fstips99', 300)">LinkedList</span>  <span class="c">//</span><span class="c"> </span><span class="c">aka:</span><span class="c"> </span><span class="c">cons</span>
<span class="l">103: </span>              <span class="c">//</span><span class="c"> </span><span class="c">aka:</span><span class="c"> </span><span class="c">car</span><span class="c">   </span><span class="c">//</span><span class="c"> </span><span class="c">aka:</span><span class="c"> </span><span class="c">cdr</span></pre>
</p>
<p/>
Remember that functions are data too, so this means we can recursively deconstruct functions, or recursively construct them and hand them out to be evaluated later, as we do in Continuation Passing Style.  We could specify the drakeEq like so:</p>
<p/>

<pre class="fssnip"><span class="l">104: </span><span class="k">let</span> <span class="i" onmouseover="showTip(event, 'fstips102', 301)" onmouseout="hideTip(event, 'fstips102', 301)">drakeEq'</span> (<span class="i" onmouseover="showTip(event, 'fstips88', 302)" onmouseout="hideTip(event, 'fstips88', 302)">R</span>,<span class="i" onmouseover="showTip(event, 'fstips89', 303)" onmouseout="hideTip(event, 'fstips89', 303)">fp</span>,<span class="i" onmouseover="showTip(event, 'fstips90', 304)" onmouseout="hideTip(event, 'fstips90', 304)">ne</span>,<span class="i" onmouseover="showTip(event, 'fstips91', 305)" onmouseout="hideTip(event, 'fstips91', 305)">fl</span>,<span class="i" onmouseover="showTip(event, 'fstips92', 306)" onmouseout="hideTip(event, 'fstips92', 306)">fi</span>,<span class="i" onmouseover="showTip(event, 'fstips93', 307)" onmouseout="hideTip(event, 'fstips93', 307)">fc</span>,<span class="i" onmouseover="showTip(event, 'fstips94', 308)" onmouseout="hideTip(event, 'fstips94', 308)">L</span>) <span class="o">:</span> <span class="i" onmouseover="showTip(event, 'fstips95', 309)" onmouseout="hideTip(event, 'fstips95', 309)">float</span> <span class="o">=</span>
<span class="l">105: </span>  (<span class="i" onmouseover="showTip(event, 'fstips95', 310)" onmouseout="hideTip(event, 'fstips95', 310)">float</span> <span class="i" onmouseover="showTip(event, 'fstips96', 311)" onmouseout="hideTip(event, 'fstips96', 311)">R</span>) <span class="o">*</span> <span class="i" onmouseover="showTip(event, 'fstips89', 312)" onmouseout="hideTip(event, 'fstips89', 312)">fp</span> <span class="o">*</span> <span class="i" onmouseover="showTip(event, 'fstips90', 313)" onmouseout="hideTip(event, 'fstips90', 313)">ne</span> <span class="o">*</span> <span class="i" onmouseover="showTip(event, 'fstips91', 314)" onmouseout="hideTip(event, 'fstips91', 314)">fl</span> <span class="o">*</span> <span class="i" onmouseover="showTip(event, 'fstips92', 315)" onmouseout="hideTip(event, 'fstips92', 315)">fi</span> <span class="o">*</span> <span class="i" onmouseover="showTip(event, 'fstips93', 316)" onmouseout="hideTip(event, 'fstips93', 316)">fc</span> <span class="o">*</span> (<span class="i" onmouseover="showTip(event, 'fstips95', 317)" onmouseout="hideTip(event, 'fstips95', 317)">float</span> <span class="i" onmouseover="showTip(event, 'fstips97', 318)" onmouseout="hideTip(event, 'fstips97', 318)">L</span>)</pre>
</p>
<p/>
This changes the signature to:</p>
<p/>
\(drakeEq' : int * float * float * float * float * float * int \rightarrow float \)</p>
<p/>
And we lose the ability to curry the function on each of the inputs.  Because the notation (value1,value2) represents a tuple in F# and a tuple is essentially just one composite value. So, the real power behind currying can be harnessed in this way, as well as; Higher Order Functions (HoF), Partial Application, and continuation passing style, for example.  Let’s take a look at each one of those concepts.</p>
<p/>

<pre class="fssnip"><span class="l">106: </span><span class="k">let</span> <span class="i" onmouseover="showTip(event, 'fstips103', 319)" onmouseout="hideTip(event, 'fstips103', 319)">xs</span> <span class="o">=</span> <span class="i" onmouseover="showTip(event, 'fstips101', 320)" onmouseout="hideTip(event, 'fstips101', 320)">Element</span>(<span class="n">1</span>, <span class="i" onmouseover="showTip(event, 'fstips101', 321)" onmouseout="hideTip(event, 'fstips101', 321)">Element</span>(<span class="n">2</span>, <span class="i" onmouseover="showTip(event, 'fstips101', 322)" onmouseout="hideTip(event, 'fstips101', 322)">Element</span>(<span class="n">3</span>,<span class="i" onmouseover="showTip(event, 'fstips100', 323)" onmouseout="hideTip(event, 'fstips100', 323)">Empty</span>)))
<span class="l">107: </span><span class="c">//</span><span class="c"> </span><span class="c">these</span><span class="c"> </span><span class="c">signatures</span><span class="c"> </span><span class="c">compose</span>
<span class="l">108: </span>[<span class="n">1..</span><span class="n">9</span>]               <span class="c">//</span><span class="c"> </span><span class="c">int</span><span class="c"> </span><span class="c">list</span><span class="c"> </span><span class="c">is</span><span class="c"> </span><span class="c">usable</span><span class="c"> </span><span class="c">as</span><span class="c"> </span><span class="c">an</span><span class="c"> </span><span class="c">seq&lt;'a&gt;</span>
<span class="l">109: </span>( <span class="o">|&gt;</span> )               <span class="c">//</span><span class="c"> </span><span class="c">('a</span><span class="c"> </span><span class="c">-&gt;</span><span class="c"> </span><span class="c">('a</span><span class="c"> </span><span class="c">-&gt;</span><span class="c"> </span><span class="c">'b)</span><span class="c"> </span><span class="c">-&gt;</span><span class="c"> </span><span class="c">'b)</span>
<span class="l">110: </span>(<span class="i" onmouseover="showTip(event, 'fstips24', 324)" onmouseout="hideTip(event, 'fstips24', 324)">Seq</span><span class="o">.</span><span class="i" onmouseover="showTip(event, 'fstips104', 325)" onmouseout="hideTip(event, 'fstips104', 325)">filter</span>)         <span class="c">//</span><span class="c"> </span><span class="c">(('a</span><span class="c"> </span><span class="c">-&gt;</span><span class="c"> </span><span class="c">bool)</span><span class="c"> </span><span class="c">-&gt;</span><span class="c"> </span><span class="c">seq&lt;'a&gt;</span><span class="c"> </span><span class="c">-&gt;</span><span class="c"> </span><span class="c">seq&lt;'a&gt;)</span>
<span class="l">111: </span>(<span class="k">fun</span> <span class="i" onmouseover="showTip(event, 'fstips105', 326)" onmouseout="hideTip(event, 'fstips105', 326)">x</span> <span class="k">-&gt;</span> <span class="i" onmouseover="showTip(event, 'fstips105', 327)" onmouseout="hideTip(event, 'fstips105', 327)">x</span> <span class="o">%</span> <span class="n">3</span> <span class="o">=</span> <span class="n">0</span>) <span class="c">//</span><span class="c"> </span><span class="c">(int</span><span class="c"> </span><span class="c">-&gt;</span><span class="c"> </span><span class="c">bool)</span>
<span class="l">112: </span>
<span class="l">113: </span><span class="c">//</span><span class="c"> </span><span class="c">into</span><span class="c"> </span><span class="c">this</span><span class="c"> </span><span class="c">higher</span><span class="c"> </span><span class="c">order</span><span class="c"> </span><span class="c">function</span>
<span class="l">114: </span>[<span class="n">1..</span><span class="n">9</span>] <span class="o">|&gt;</span> <span class="i" onmouseover="showTip(event, 'fstips24', 328)" onmouseout="hideTip(event, 'fstips24', 328)">Seq</span><span class="o">.</span><span class="i" onmouseover="showTip(event, 'fstips104', 329)" onmouseout="hideTip(event, 'fstips104', 329)">filter</span> (<span class="k">fun</span> <span class="i" onmouseover="showTip(event, 'fstips105', 330)" onmouseout="hideTip(event, 'fstips105', 330)">x</span> <span class="k">-&gt;</span> <span class="i" onmouseover="showTip(event, 'fstips105', 331)" onmouseout="hideTip(event, 'fstips105', 331)">x</span> <span class="o">%</span> <span class="n">3</span> <span class="o">=</span> <span class="n">0</span>)</pre>
</p>
<p/>
The type <i>‘a</i> is special and stands for a generic type.  The type <i>‘b</i> stands for a generic type that isn’t necessarily the same type as <i>‘a</i>.  The evaluation order for line 114 considers <i>( |&gt; )</i> first.  The job of <i>( |&gt; )</i> is to put the expression on the left into the expression on the right.  When the type is evaluated it is inferred to be the type <i>int</i>.  So our <i>‘a</i> here is really standing for <i>int</i> now.  The next part that is evaluated is the lambda.  Easy to see that its type is <i>(int -&gt; bool)</i> and since <i>‘a</i> stands for <i>int</i>, it fits nicely into the first parameter of <i>Seq.filter</i>.  <i>Seq.filter</i> enumerates our list applying the lambda to each element and returns to us a <i>seq&lt;int&gt;</i> containing the elements <i>[3;6;9]</i>. </p>
<p/>
The compiled representation of an F# function is an instance of the <i>Microsoft.FSharp.FastFunc</i> class.  F# functions are <u>not</u> delegates.</p>
<p/>

<pre class="fssnip"><span class="l">116: </span><span class="c">//</span><span class="c"> </span><span class="c">partial</span><span class="c"> </span><span class="c">application</span>
<span class="l">117: </span><span class="k">let</span> <span class="i" onmouseover="showTip(event, 'fstips106', 332)" onmouseout="hideTip(event, 'fstips106', 332)">next</span>      <span class="o">=</span> <span class="i" onmouseover="showTip(event, 'fstips81', 333)" onmouseout="hideTip(event, 'fstips81', 333)">sum</span> <span class="n">1</span>                         <span class="c">//</span><span class="c"> </span><span class="c">val</span><span class="c"> </span><span class="c">next</span><span class="c">  </span><span class="c">:</span><span class="c"> </span><span class="c">int</span><span class="c"> </span><span class="c">-&gt;</span><span class="c"> </span><span class="c">int</span>
<span class="l">118: </span><span class="k">let</span> <span class="i" onmouseover="showTip(event, 'fstips107', 334)" onmouseout="hideTip(event, 'fstips107', 334)">twice</span>     <span class="o">=</span> <span class="i" onmouseover="showTip(event, 'fstips84', 335)" onmouseout="hideTip(event, 'fstips84', 335)">mul</span> <span class="n">2</span>                         <span class="c">//</span><span class="c"> </span><span class="c">val</span><span class="c"> </span><span class="c">twice</span><span class="c"> </span><span class="c">:</span><span class="c"> </span><span class="c">int</span><span class="c"> </span><span class="c">-&gt;</span><span class="c"> </span><span class="c">int</span>
<span class="l">119: </span><span class="k">let</span> <span class="i" onmouseover="showTip(event, 'fstips108', 336)" onmouseout="hideTip(event, 'fstips108', 336)">x</span> <span class="o">=</span> <span class="k">let</span> <span class="i" onmouseover="showTip(event, 'fstips86', 337)" onmouseout="hideTip(event, 'fstips86', 337)">n</span> <span class="o">=</span> <span class="n">4</span> <span class="k">in</span> <span class="i" onmouseover="showTip(event, 'fstips107', 338)" onmouseout="hideTip(event, 'fstips107', 338)">twice</span> <span class="o">&lt;|</span> <span class="i" onmouseover="showTip(event, 'fstips85', 339)" onmouseout="hideTip(event, 'fstips85', 339)">sqr</span> <span class="i" onmouseover="showTip(event, 'fstips86', 340)" onmouseout="hideTip(event, 'fstips86', 340)">n</span> <span class="o">+</span> <span class="i" onmouseover="showTip(event, 'fstips106', 341)" onmouseout="hideTip(event, 'fstips106', 341)">next</span> <span class="i" onmouseover="showTip(event, 'fstips86', 342)" onmouseout="hideTip(event, 'fstips86', 342)">n</span>  <span class="c">//</span><span class="c"> </span><span class="c">val</span><span class="c"> </span><span class="c">it</span><span class="c">    </span><span class="c">:</span><span class="c"> </span><span class="c">int</span><span class="c"> </span><span class="c">=</span><span class="c"> </span><span class="c">42</span>
</pre>
</p>
<p/>
F# programmers love <a href="http://blog.thinkhard.net/wp-content/plugins/wordpress-feed-statistics/feed-statistics.php?url=aHR0cDovL2VuLndpa2lwZWRpYS5vcmcvd2lraS9Db21wb3NhYmlsaXR5">composability</a>, though these trivial examples do little to expose the great usefulness of these features.  To make the most of these features, as you gain experience, you need to become comfortable with the functional arrow notation.  Look, you don’t have to be good at math to make use of it, you really only need to know the rules for moving symbols around.
</p>
<p>
<pre class="fssnip">
<span class="l">121: </span><span class="c">//</span><span class="c"> </span><span class="c">an</span><span class="c"> </span><span class="c">example</span><span class="c"> </span><span class="c">of</span><span class="c"> </span><span class="c">continuation</span><span class="c"> </span><span class="c">passing</span><span class="c"> </span><span class="c">style</span><span class="c"> </span><span class="c">using</span><span class="c"> </span><span class="c">a</span><span class="c"> </span><span class="c">(foldBack)</span><span class="c"> </span><span class="c">catamorphism</span>
<span class="l">122: </span><span class="k">let</span> <span class="i" onmouseover="showTip(event, 'fstips109', 343)" onmouseout="hideTip(event, 'fstips109', 343)">foldr</span> <span class="i" onmouseover="showTip(event, 'fstips110', 344)" onmouseout="hideTip(event, 'fstips110', 344)">f</span> <span class="i" onmouseover="showTip(event, 'fstips111', 345)" onmouseout="hideTip(event, 'fstips111', 345)">acc</span> <span class="i" onmouseover="showTip(event, 'fstips112', 346)" onmouseout="hideTip(event, 'fstips112', 346)">xs</span> <span class="o">=</span>
<span class="l">123: </span>  <span class="k">let</span> <span class="k">rec</span> <span class="i" onmouseover="showTip(event, 'fstips113', 347)" onmouseout="hideTip(event, 'fstips113', 347)">foldr</span> <span class="i" onmouseover="showTip(event, 'fstips112', 348)" onmouseout="hideTip(event, 'fstips112', 348)">xs</span> <span class="i" onmouseover="showTip(event, 'fstips114', 349)" onmouseout="hideTip(event, 'fstips114', 349)">k</span> <span class="o">=</span>
<span class="l">124: </span>    <span class="k">match</span> <span class="i" onmouseover="showTip(event, 'fstips112', 350)" onmouseout="hideTip(event, 'fstips112', 350)">xs</span> <span class="k">with</span>
<span class="l">125: </span>    | <span class="i" onmouseover="showTip(event, 'fstips101', 351)" onmouseout="hideTip(event, 'fstips101', 351)">Element</span>(<span class="i" onmouseover="showTip(event, 'fstips115', 352)" onmouseout="hideTip(event, 'fstips115', 352)">x</span>,<span class="i" onmouseover="showTip(event, 'fstips112', 353)" onmouseout="hideTip(event, 'fstips112', 353)">xs</span>) <span class="k">-&gt;</span> <span class="i" onmouseover="showTip(event, 'fstips113', 354)" onmouseout="hideTip(event, 'fstips113', 354)">foldr</span> <span class="i" onmouseover="showTip(event, 'fstips112', 355)" onmouseout="hideTip(event, 'fstips112', 355)">xs</span> (<span class="k">fun</span> <span class="i" onmouseover="showTip(event, 'fstips116', 356)" onmouseout="hideTip(event, 'fstips116', 356)">racc</span> <span class="k">-&gt;</span> <span class="i" onmouseover="showTip(event, 'fstips114', 357)" onmouseout="hideTip(event, 'fstips114', 357)">k</span> (<span class="i" onmouseover="showTip(event, 'fstips110', 358)" onmouseout="hideTip(event, 'fstips110', 358)">f</span> <span class="i" onmouseover="showTip(event, 'fstips115', 359)" onmouseout="hideTip(event, 'fstips115', 359)">x</span> <span class="i" onmouseover="showTip(event, 'fstips116', 360)" onmouseout="hideTip(event, 'fstips116', 360)">racc</span>))
<span class="l">126: </span>    | <span class="i" onmouseover="showTip(event, 'fstips100', 361)" onmouseout="hideTip(event, 'fstips100', 361)">Empty</span>         <span class="k">-&gt;</span> <span class="i" onmouseover="showTip(event, 'fstips114', 362)" onmouseout="hideTip(event, 'fstips114', 362)">k</span> <span class="i" onmouseover="showTip(event, 'fstips111', 363)" onmouseout="hideTip(event, 'fstips111', 363)">acc</span>
<span class="l">127: </span>  <span class="i" onmouseover="showTip(event, 'fstips113', 364)" onmouseout="hideTip(event, 'fstips113', 364)">foldr</span> <span class="i" onmouseover="showTip(event, 'fstips112', 365)" onmouseout="hideTip(event, 'fstips112', 365)">xs</span> <span class="i" onmouseover="showTip(event, 'fstips117', 366)" onmouseout="hideTip(event, 'fstips117', 366)">id</span>
<span class="l">128: </span>
<span class="l">129: </span><span class="c">//</span><span class="c"> </span><span class="c">the</span><span class="c"> </span><span class="c">opposite</span><span class="c"> </span><span class="c">of</span><span class="c"> </span><span class="c">foldr</span><span class="c"> </span><span class="c">(no</span><span class="c"> </span><span class="c">continuation</span><span class="c"> </span><span class="c">passing</span><span class="c"> </span><span class="c">is</span><span class="c"> </span><span class="c">necessary)</span>
<span class="l">130: </span><span class="k">let</span> <span class="k">rec</span> <span class="i" onmouseover="showTip(event, 'fstips118', 367)" onmouseout="hideTip(event, 'fstips118', 367)">foldl</span> <span class="i" onmouseover="showTip(event, 'fstips119', 368)" onmouseout="hideTip(event, 'fstips119', 368)">f</span> <span class="i" onmouseover="showTip(event, 'fstips120', 369)" onmouseout="hideTip(event, 'fstips120', 369)">acc</span> <span class="i" onmouseover="showTip(event, 'fstips121', 370)" onmouseout="hideTip(event, 'fstips121', 370)">xs</span> <span class="o">=</span>
<span class="l">131: </span>  <span class="k">match</span> <span class="i" onmouseover="showTip(event, 'fstips121', 371)" onmouseout="hideTip(event, 'fstips121', 371)">xs</span> <span class="k">with</span>
<span class="l">132: </span>  | <span class="i" onmouseover="showTip(event, 'fstips101', 372)" onmouseout="hideTip(event, 'fstips101', 372)">Element</span>(<span class="i" onmouseover="showTip(event, 'fstips122', 373)" onmouseout="hideTip(event, 'fstips122', 373)">x</span>,<span class="i" onmouseover="showTip(event, 'fstips121', 374)" onmouseout="hideTip(event, 'fstips121', 374)">xs</span>) <span class="k">-&gt;</span> <span class="i" onmouseover="showTip(event, 'fstips118', 375)" onmouseout="hideTip(event, 'fstips118', 375)">foldl</span> <span class="i" onmouseover="showTip(event, 'fstips119', 376)" onmouseout="hideTip(event, 'fstips119', 376)">f</span> (<span class="i" onmouseover="showTip(event, 'fstips119', 377)" onmouseout="hideTip(event, 'fstips119', 377)">f</span> <span class="i" onmouseover="showTip(event, 'fstips120', 378)" onmouseout="hideTip(event, 'fstips120', 378)">acc</span> <span class="i" onmouseover="showTip(event, 'fstips122', 379)" onmouseout="hideTip(event, 'fstips122', 379)">x</span>) <span class="i" onmouseover="showTip(event, 'fstips121', 380)" onmouseout="hideTip(event, 'fstips121', 380)">xs</span>
<span class="l">133: </span>  | <span class="i" onmouseover="showTip(event, 'fstips100', 381)" onmouseout="hideTip(event, 'fstips100', 381)">Empty</span>         <span class="k">-&gt;</span> <span class="i" onmouseover="showTip(event, 'fstips120', 382)" onmouseout="hideTip(event, 'fstips120', 382)">acc</span>
<span class="l">134: </span>
<span class="l">135: </span><span class="c">//</span><span class="c"> </span><span class="c">some</span><span class="c"> </span><span class="c">higher</span><span class="c"> </span><span class="c">order</span><span class="c"> </span><span class="c">functions</span><span class="c"> </span><span class="c">implemented</span><span class="c"> </span><span class="c">in</span><span class="c"> </span><span class="c">terms</span><span class="c"> </span><span class="c">of</span><span class="c"> </span><span class="c">folds</span>
<span class="l">136: </span><span class="k">let</span> <span class="i" onmouseover="showTip(event, 'fstips123', 383)" onmouseout="hideTip(event, 'fstips123', 383)">identity</span>  <span class="i" onmouseover="showTip(event, 'fstips112', 384)" onmouseout="hideTip(event, 'fstips112', 384)">xs</span> <span class="o">=</span> <span class="i" onmouseover="showTip(event, 'fstips109', 385)" onmouseout="hideTip(event, 'fstips109', 385)">foldr</span> (<span class="k">fun</span> <span class="i" onmouseover="showTip(event, 'fstips115', 386)" onmouseout="hideTip(event, 'fstips115', 386)">x</span> <span class="i" onmouseover="showTip(event, 'fstips112', 387)" onmouseout="hideTip(event, 'fstips112', 387)">xs</span> <span class="k">-&gt;</span> <span class="i" onmouseover="showTip(event, 'fstips101', 388)" onmouseout="hideTip(event, 'fstips101', 388)">Element</span>(<span class="i" onmouseover="showTip(event, 'fstips115', 389)" onmouseout="hideTip(event, 'fstips115', 389)">x</span>,<span class="i" onmouseover="showTip(event, 'fstips112', 390)" onmouseout="hideTip(event, 'fstips112', 390)">xs</span>)) (<span class="i" onmouseover="showTip(event, 'fstips100', 391)" onmouseout="hideTip(event, 'fstips100', 391)">Empty</span>) <span class="i" onmouseover="showTip(event, 'fstips112', 392)" onmouseout="hideTip(event, 'fstips112', 392)">xs</span>
<span class="l">137: </span><span class="k">let</span> <span class="i" onmouseover="showTip(event, 'fstips124', 393)" onmouseout="hideTip(event, 'fstips124', 393)">reverse</span>   <span class="i" onmouseover="showTip(event, 'fstips112', 394)" onmouseout="hideTip(event, 'fstips112', 394)">xs</span> <span class="o">=</span> <span class="i" onmouseover="showTip(event, 'fstips118', 395)" onmouseout="hideTip(event, 'fstips118', 395)">foldl</span> (<span class="k">fun</span> <span class="i" onmouseover="showTip(event, 'fstips112', 396)" onmouseout="hideTip(event, 'fstips112', 396)">xs</span> <span class="i" onmouseover="showTip(event, 'fstips115', 397)" onmouseout="hideTip(event, 'fstips115', 397)">x</span> <span class="k">-&gt;</span> <span class="i" onmouseover="showTip(event, 'fstips101', 398)" onmouseout="hideTip(event, 'fstips101', 398)">Element</span>(<span class="i" onmouseover="showTip(event, 'fstips115', 399)" onmouseout="hideTip(event, 'fstips115', 399)">x</span>,<span class="i" onmouseover="showTip(event, 'fstips112', 400)" onmouseout="hideTip(event, 'fstips112', 400)">xs</span>)) (<span class="i" onmouseover="showTip(event, 'fstips100', 401)" onmouseout="hideTip(event, 'fstips100', 401)">Empty</span>) <span class="i" onmouseover="showTip(event, 'fstips112', 402)" onmouseout="hideTip(event, 'fstips112', 402)">xs</span>
<span class="l">138: </span><span class="k">let</span> <span class="i" onmouseover="showTip(event, 'fstips125', 403)" onmouseout="hideTip(event, 'fstips125', 403)">length</span>    <span class="i" onmouseover="showTip(event, 'fstips112', 404)" onmouseout="hideTip(event, 'fstips112', 404)">xs</span> <span class="o">=</span> <span class="i" onmouseover="showTip(event, 'fstips118', 405)" onmouseout="hideTip(event, 'fstips118', 405)">foldl</span> (<span class="k">fun</span> <span class="i" onmouseover="showTip(event, 'fstips126', 406)" onmouseout="hideTip(event, 'fstips126', 406)">xs</span> _ <span class="k">-&gt;</span> <span class="n">1</span> <span class="o">+</span> <span class="i" onmouseover="showTip(event, 'fstips126', 407)" onmouseout="hideTip(event, 'fstips126', 407)">xs</span>)           <span class="n">0</span>    <span class="i" onmouseover="showTip(event, 'fstips126', 408)" onmouseout="hideTip(event, 'fstips126', 408)">xs</span>
<span class="l">139: </span><span class="k">let</span> <span class="i" onmouseover="showTip(event, 'fstips127', 409)" onmouseout="hideTip(event, 'fstips127', 409)">summation</span> <span class="i" onmouseover="showTip(event, 'fstips128', 410)" onmouseout="hideTip(event, 'fstips128', 410)">xs</span> <span class="o">=</span> <span class="i" onmouseover="showTip(event, 'fstips118', 411)" onmouseout="hideTip(event, 'fstips118', 411)">foldl</span> (<span class="k">fun</span> <span class="i" onmouseover="showTip(event, 'fstips126', 412)" onmouseout="hideTip(event, 'fstips126', 412)">xs</span> <span class="i" onmouseover="showTip(event, 'fstips105', 413)" onmouseout="hideTip(event, 'fstips105', 413)">x</span> <span class="k">-&gt;</span> <span class="i" onmouseover="showTip(event, 'fstips105', 414)" onmouseout="hideTip(event, 'fstips105', 414)">x</span> <span class="o">+</span> <span class="i" onmouseover="showTip(event, 'fstips126', 415)" onmouseout="hideTip(event, 'fstips126', 415)">xs</span>)           <span class="n">0</span>    <span class="i" onmouseover="showTip(event, 'fstips126', 416)" onmouseout="hideTip(event, 'fstips126', 416)">xs</span>
<span class="l">140: </span><span class="k">let</span> <span class="i" onmouseover="showTip(event, 'fstips129', 417)" onmouseout="hideTip(event, 'fstips129', 417)">product</span>   <span class="i" onmouseover="showTip(event, 'fstips128', 418)" onmouseout="hideTip(event, 'fstips128', 418)">xs</span> <span class="o">=</span> <span class="i" onmouseover="showTip(event, 'fstips118', 419)" onmouseout="hideTip(event, 'fstips118', 419)">foldl</span> (<span class="k">fun</span> <span class="i" onmouseover="showTip(event, 'fstips126', 420)" onmouseout="hideTip(event, 'fstips126', 420)">xs</span> <span class="i" onmouseover="showTip(event, 'fstips105', 421)" onmouseout="hideTip(event, 'fstips105', 421)">x</span> <span class="k">-&gt;</span> <span class="i" onmouseover="showTip(event, 'fstips105', 422)" onmouseout="hideTip(event, 'fstips105', 422)">x</span> <span class="o">*</span> <span class="i" onmouseover="showTip(event, 'fstips126', 423)" onmouseout="hideTip(event, 'fstips126', 423)">xs</span>)           <span class="n">1</span>    <span class="i" onmouseover="showTip(event, 'fstips126', 424)" onmouseout="hideTip(event, 'fstips126', 424)">xs</span>
</pre>
</p>
<p/>
Folding is pretty useful and goes a long way to creating elegant and composable programs.  You can also call folding a <i>“catamorphism”</i>.  Folding is easier to say, but catamorphism is a lot more meaningful, and more general.  By the way, the dual of any theorem is also a theorem.  If you’ve been using the intellisense on the code to view the signatures of these functions you will notice that a cataomorphism on our <i>LinkedList</i> type is: </p>
<p/>
\(LinkedList<'a> \rightarrow ‘b\)</p>
<p/>
To “dualize” this we simply turn the arrow around.</p>
<p/>
\(‘a \rightarrow LinkedList<'b>\)</p>
<p/>
Here, we don’t have to worry about the discrepancy between the positions of <i>‘a</i> and <i>‘b</i>.  They’re equally generic. Intellisense will typically report them in alphabetical order.</p>
<p/>

<pre class="fssnip">
<span class="l">142: </span><span class="c">//</span><span class="c"> </span><span class="c">the</span><span class="c"> </span><span class="c">dual</span><span class="c"> </span><span class="c">of</span><span class="c"> </span><span class="c">folding,</span><span class="c">  </span><span class="c">unfolding</span>
<span class="l">143: </span><span class="k">let</span> <span class="k">rec</span> <span class="i" onmouseover="showTip(event, 'fstips130', 425)" onmouseout="hideTip(event, 'fstips130', 425)">unfold</span> <span class="i" onmouseover="showTip(event, 'fstips131', 426)" onmouseout="hideTip(event, 'fstips131', 426)">unspool</span> <span class="i" onmouseover="showTip(event, 'fstips132', 427)" onmouseout="hideTip(event, 'fstips132', 427)">finished</span> <span class="i" onmouseover="showTip(event, 'fstips115', 428)" onmouseout="hideTip(event, 'fstips115', 428)">x</span> <span class="o">=</span> 
<span class="l">144: </span>  <span class="k">match</span> <span class="i" onmouseover="showTip(event, 'fstips115', 429)" onmouseout="hideTip(event, 'fstips115', 429)">x</span> <span class="k">with</span>
<span class="l">145: </span>  | <span class="i" onmouseover="showTip(event, 'fstips115', 430)" onmouseout="hideTip(event, 'fstips115', 430)">x</span> <span class="k">when</span> <span class="i" onmouseover="showTip(event, 'fstips132', 431)" onmouseout="hideTip(event, 'fstips132', 431)">finished</span> <span class="i" onmouseover="showTip(event, 'fstips115', 432)" onmouseout="hideTip(event, 'fstips115', 432)">x</span> <span class="k">-&gt;</span> <span class="i" onmouseover="showTip(event, 'fstips100', 433)" onmouseout="hideTip(event, 'fstips100', 433)">Empty</span>
<span class="l">146: </span>  | _ <span class="k">-&gt;</span> <span class="k">let</span> <span class="i" onmouseover="showTip(event, 'fstips133', 434)" onmouseout="hideTip(event, 'fstips133', 434)">a</span>,<span class="i" onmouseover="showTip(event, 'fstips134', 435)" onmouseout="hideTip(event, 'fstips134', 435)">y</span> <span class="o">=</span> <span class="i" onmouseover="showTip(event, 'fstips131', 436)" onmouseout="hideTip(event, 'fstips131', 436)">unspool</span> <span class="i" onmouseover="showTip(event, 'fstips115', 437)" onmouseout="hideTip(event, 'fstips115', 437)">x</span> <span class="k">in</span> <span class="i" onmouseover="showTip(event, 'fstips101', 438)" onmouseout="hideTip(event, 'fstips101', 438)">Element</span>(<span class="i" onmouseover="showTip(event, 'fstips133', 439)" onmouseout="hideTip(event, 'fstips133', 439)">a</span>,<span class="i" onmouseover="showTip(event, 'fstips130', 440)" onmouseout="hideTip(event, 'fstips130', 440)">unfold</span> <span class="i" onmouseover="showTip(event, 'fstips131', 441)" onmouseout="hideTip(event, 'fstips131', 441)">unspool</span> <span class="i" onmouseover="showTip(event, 'fstips132', 442)" onmouseout="hideTip(event, 'fstips132', 442)">finished</span> <span class="i" onmouseover="showTip(event, 'fstips134', 443)" onmouseout="hideTip(event, 'fstips134', 443)">y</span>)
<span class="l">147: </span>
<span class="l">148: </span><span class="k">let</span> <span class="i" onmouseover="showTip(event, 'fstips135', 444)" onmouseout="hideTip(event, 'fstips135', 444)">fibUntil</span> <span class="i" onmouseover="showTip(event, 'fstips136', 445)" onmouseout="hideTip(event, 'fstips136', 445)">until</span> <span class="o">=</span> 
<span class="l">149: </span>  <span class="i" onmouseover="showTip(event, 'fstips130', 446)" onmouseout="hideTip(event, 'fstips130', 446)">unfold</span> (<span class="k">fun</span> <span class="i" onmouseover="showTip(event, 'fstips137', 447)" onmouseout="hideTip(event, 'fstips137', 447)">x</span> <span class="k">-&gt;</span> <span class="k">let</span> <span class="i" onmouseover="showTip(event, 'fstips138', 448)" onmouseout="hideTip(event, 'fstips138', 448)">b'</span> <span class="o">=</span> (<span class="i" onmouseover="showTip(event, 'fstips139', 449)" onmouseout="hideTip(event, 'fstips139', 449)">fst</span> <span class="i" onmouseover="showTip(event, 'fstips137', 450)" onmouseout="hideTip(event, 'fstips137', 450)">x</span> <span class="o">+</span> <span class="i" onmouseover="showTip(event, 'fstips140', 451)" onmouseout="hideTip(event, 'fstips140', 451)">snd</span> <span class="i" onmouseover="showTip(event, 'fstips137', 452)" onmouseout="hideTip(event, 'fstips137', 452)">x</span>) <span class="k">in</span> (<span class="i" onmouseover="showTip(event, 'fstips138', 453)" onmouseout="hideTip(event, 'fstips138', 453)">b'</span>,(<span class="i" onmouseover="showTip(event, 'fstips140', 454)" onmouseout="hideTip(event, 'fstips140', 454)">snd</span> <span class="i" onmouseover="showTip(event, 'fstips137', 455)" onmouseout="hideTip(event, 'fstips137', 455)">x</span>, <span class="i" onmouseover="showTip(event, 'fstips138', 456)" onmouseout="hideTip(event, 'fstips138', 456)">b'</span>)))
<span class="l">150: </span>         (<span class="k">fun</span> <span class="i" onmouseover="showTip(event, 'fstips137', 457)" onmouseout="hideTip(event, 'fstips137', 457)">x</span> <span class="k">-&gt;</span> <span class="i" onmouseover="showTip(event, 'fstips140', 458)" onmouseout="hideTip(event, 'fstips140', 458)">snd</span> <span class="i" onmouseover="showTip(event, 'fstips137', 459)" onmouseout="hideTip(event, 'fstips137', 459)">x</span> <span class="o">&gt;</span><span class="o">=</span> <span class="i" onmouseover="showTip(event, 'fstips136', 460)" onmouseout="hideTip(event, 'fstips136', 460)">until</span> )
<span class="l">151: </span>         (<span class="n">0</span>,<span class="n">1</span>)
<span class="l">152: </span>
<span class="l">153: </span><span class="i" onmouseover="showTip(event, 'fstips135', 461)" onmouseout="hideTip(event, 'fstips135', 461)">fibUntil</span> <span class="n">34</span>
<span class="l">154: </span>
<span class="l">155: </span><span class="k">let</span> <span class="i" onmouseover="showTip(event, 'fstips141', 462)" onmouseout="hideTip(event, 'fstips141', 462)">fibs</span> (<span class="i" onmouseover="showTip(event, 'fstips105', 463)" onmouseout="hideTip(event, 'fstips105', 463)">x</span> <span class="o">:</span> <span class="i" onmouseover="showTip(event, 'fstips98', 464)" onmouseout="hideTip(event, 'fstips98', 464)">int</span>)  <span class="o">=</span>
<span class="l">156: </span>  <span class="k">let</span> <span class="i" onmouseover="showTip(event, 'fstips142', 465)" onmouseout="hideTip(event, 'fstips142', 465)">x</span> <span class="o">=</span> <span class="i" onmouseover="showTip(event, 'fstips143', 466)" onmouseout="hideTip(event, 'fstips143', 466)">ref</span> <span class="i" onmouseover="showTip(event, 'fstips105', 467)" onmouseout="hideTip(event, 'fstips105', 467)">x</span> <span class="k">in</span>
<span class="l">157: </span>  <span class="i" onmouseover="showTip(event, 'fstips130', 468)" onmouseout="hideTip(event, 'fstips130', 468)">unfold</span> ( <span class="k">fun</span> <span class="i" onmouseover="showTip(event, 'fstips137', 469)" onmouseout="hideTip(event, 'fstips137', 469)">x</span>   <span class="k">-&gt;</span> <span class="k">let</span> <span class="i" onmouseover="showTip(event, 'fstips138', 470)" onmouseout="hideTip(event, 'fstips138', 470)">b'</span> <span class="o">=</span> (<span class="i" onmouseover="showTip(event, 'fstips139', 471)" onmouseout="hideTip(event, 'fstips139', 471)">fst</span> <span class="i" onmouseover="showTip(event, 'fstips137', 472)" onmouseout="hideTip(event, 'fstips137', 472)">x</span> <span class="o">+</span> <span class="i" onmouseover="showTip(event, 'fstips140', 473)" onmouseout="hideTip(event, 'fstips140', 473)">snd</span> <span class="i" onmouseover="showTip(event, 'fstips137', 474)" onmouseout="hideTip(event, 'fstips137', 474)">x</span>) <span class="k">in</span> (<span class="i" onmouseover="showTip(event, 'fstips138', 475)" onmouseout="hideTip(event, 'fstips138', 475)">b'</span>,(<span class="i" onmouseover="showTip(event, 'fstips140', 476)" onmouseout="hideTip(event, 'fstips140', 476)">snd</span> <span class="i" onmouseover="showTip(event, 'fstips137', 477)" onmouseout="hideTip(event, 'fstips137', 477)">x</span>, <span class="i" onmouseover="showTip(event, 'fstips138', 478)" onmouseout="hideTip(event, 'fstips138', 478)">b'</span>)))
<span class="l">158: </span>         ((<span class="k">fun</span> <span class="i" onmouseover="showTip(event, 'fstips142', 479)" onmouseout="hideTip(event, 'fstips142', 479)">x</span> _ <span class="k">-&gt;</span> <span class="k">if</span> <span class="o">!</span><span class="i" onmouseover="showTip(event, 'fstips142', 480)" onmouseout="hideTip(event, 'fstips142', 480)">x</span> <span class="o">=</span> <span class="n">0</span> <span class="k">then</span>    <span class="k">true</span>
<span class="l">159: </span>                      <span class="k">else</span> <span class="i" onmouseover="showTip(event, 'fstips142', 481)" onmouseout="hideTip(event, 'fstips142', 481)">x</span> <span class="o">:=</span> <span class="o">!</span><span class="i" onmouseover="showTip(event, 'fstips142', 482)" onmouseout="hideTip(event, 'fstips142', 482)">x</span> <span class="o">-</span> <span class="n">1</span>; <span class="k">false</span> ) <span class="o">&lt;|</span> <span class="i" onmouseover="showTip(event, 'fstips142', 483)" onmouseout="hideTip(event, 'fstips142', 483)">x</span>)
<span class="l">160: </span>         (<span class="n">0</span>,<span class="n">1</span>)
<span class="l">161: </span>
<span class="l">162: </span><span class="i" onmouseover="showTip(event, 'fstips141', 484)" onmouseout="hideTip(event, 'fstips141', 484)">fibs</span> <span class="n">10</span>
</pre>
</p>
<p/>
Unfolding is also useful and goes just as far toward creating elegant and composable programs.  You can also call unfolding an <i>“anamorphism”</i>.  However, I should let you know that my sloppy blog solutions are no match for what F# provides out of the box.  I just wanted an anamorphism over our <i>LinkedList</i> type we defined above.  <i>LinkedList</i> already comes with F# as <i>List</i> and a lazy version, <i>LazyList</i>, is available in <a href="http://blog.thinkhard.net/wp-content/plugins/wordpress-feed-statistics/feed-statistics.php?url=aHR0cDovL2ZzaGFycHBvd2VycGFjay5jb2RlcGxleC5jb20v">PowerPack</a>.   When unfolding though, we don’t know when we’re going to stop so it is definitely better to use a lazy data structure.  F# gives us the <i>Seq</i> module that works with any <i>IEnumerable</i>:</p>
<p/>

<pre class="fssnip">
<span class="l">164: </span><span class="c">//</span><span class="c"> </span><span class="c">best</span><span class="c"> </span><span class="c">to</span><span class="c"> </span><span class="c">use</span><span class="c"> </span><span class="c">whats</span><span class="c"> </span><span class="c">already</span><span class="c"> </span><span class="c">in</span><span class="c"> </span><span class="c">the</span><span class="c"> </span><span class="c">framework</span>
<span class="l">165: </span><span class="k">let</span> <span class="i" onmouseover="showTip(event, 'fstips144', 485)" onmouseout="hideTip(event, 'fstips144', 485)">fibonacci</span> <span class="o">=</span> <span class="i" onmouseover="showTip(event, 'fstips24', 486)" onmouseout="hideTip(event, 'fstips24', 486)">Seq</span><span class="o">.</span><span class="i" onmouseover="showTip(event, 'fstips145', 487)" onmouseout="hideTip(event, 'fstips145', 487)">unfold</span> (<span class="k">fun</span> (<span class="i" onmouseover="showTip(event, 'fstips146', 488)" onmouseout="hideTip(event, 'fstips146', 488)">x</span>, <span class="i" onmouseover="showTip(event, 'fstips147', 489)" onmouseout="hideTip(event, 'fstips147', 489)">y</span>) <span class="k">-&gt;</span> <span class="i" onmouseover="showTip(event, 'fstips148', 490)" onmouseout="hideTip(event, 'fstips148', 490)">Some</span>(<span class="i" onmouseover="showTip(event, 'fstips146', 491)" onmouseout="hideTip(event, 'fstips146', 491)">x</span>, (<span class="i" onmouseover="showTip(event, 'fstips147', 492)" onmouseout="hideTip(event, 'fstips147', 492)">y</span>, <span class="i" onmouseover="showTip(event, 'fstips146', 493)" onmouseout="hideTip(event, 'fstips146', 493)">x</span> <span class="o">+</span> <span class="i" onmouseover="showTip(event, 'fstips147', 494)" onmouseout="hideTip(event, 'fstips147', 494)">y</span>))) (<span class="n">0I</span>,<span class="n">1I</span>)
<span class="l">166: </span><span class="i" onmouseover="showTip(event, 'fstips144', 495)" onmouseout="hideTip(event, 'fstips144', 495)">fibonacci</span> <span class="o">|&gt;</span> <span class="i" onmouseover="showTip(event, 'fstips24', 496)" onmouseout="hideTip(event, 'fstips24', 496)">Seq</span><span class="o">.</span><span class="i" onmouseover="showTip(event, 'fstips149', 497)" onmouseout="hideTip(event, 'fstips149', 497)">nth</span> <span class="n">10000</span>
</pre>
</p>
<p/>
Mathematicians don’t like a lot of cruft in their notation, especially when simple symbols will do the trick.  A function is like a machine that relates an input to an output.   Another way of looking at a function is a sort of dictionary.  Where the input is the key, and the output is the value.  In fact, I really like that way of looking at things.  You cannot have the same key mapping to different values.  Neither may a function relate its input to different values (unless these values have been tuple&#8217;d into one value!).  Notice the similarity here between the F# function signatures:</p>
<p/>
Signature:<br />
\(f : {N} \rightarrow {N}\)<br/><br />
Implementation:<br />
\(f : x \mapsto x^2\)</p>
<p/>
Functions usually have a name, but like F# you don&#8217;t have to necessarily give them one: \(x = n^2\).  There is still an input <i>n</i> and an output <i>y</i> and the relation of squaring.</p>
<p/>
\(f(x) = x^2\)</p>
<p/>
We read this as &#8220;f of x equals x squared&#8221;.  Of course <i>x</i> is definately numerical in nature, so in F# it would be like: <i>let inline f (x : ^x) = x * x</i>.  A bit more wordy, but computers aren&#8217;t as smart as mathematicians so we have to clue them in that ^x here needs to be statically resolved.</p>
<p/>
Functions have formal rules.  It must work every time for every possible input value.  It must give the same result for the same input value every time. You can only have one relation for each input value.  One-to-many relations are not O.K., but many-to-one relations are just fine.  If a relationship doesn&#8217;t follow these rules, then it is not a function.  These rules are very important in the long run for making educated assumptions regarding the interaction, or rather, the composition of functions in a complex system.</p>
<p/>
The <i>Domain</i> of a function is it&#8217;s spectrum of input.  The <i>Codomain</i> is its spectrum of output.  The <i>Range</i> of a function is some subset of the codomain, for which the domain relates.  A <i>Relationship</i> is the operation performed on the domain to give us a value in the codomain.  For instance, using the relation \(x^2\) in the domain of Integers (\({Z}\) then we know that \(f : {Z} \rightarrow {Z}\) is the signature of our function.   The \(\mapsto\) in \(f : x \mapsto x^2\) is called &#8220;maps to&#8221; and maps an integer to another integer.  Or, if you prefer to imagine it as a table lookup, it &#8220;looks up&#8221; an integer value using an integer key.  Though the domain and codomain are the same sets, the range of our relation \(x^2\) is a subset of \({Z}\).  You do the math on that one.</p>
<p/>
Functions can come in pieces, called piecewise functions.  F# can do piecewise functions using pattern matching syntax.  Have a look at the <i>foldr</i> and <i>foldl</i> implementations again.  Sometimes you&#8217;re matching on the quality of a type instead of a type itself&#8230; in that case pattern matching accompanied by Active Patterns will give you the same semantics as piecewise functions in mathematics.</p>
<h2>BONUS:</h2>
<p/>
I can imagine a situation where we would want to take from the domain of our Drake equation the most educated guesses we have available to restrict the range to some known quantity.  For instance we know for certain there is 1 civilization in our galaxy capable of radio astronomy.  Maybe there is more than one educated guess for each of the drake equation&#8217;s parameters.  There’s really no use in bickering about which one is the better one… after all they’re both estimates and outright guesses, right?  We do have a pretty good guess for <i>R</i>, and we can say that <i>N</i> is definately equal to 1.  What could the others be?   Enter: Solver Foundation.</p>
<p/>

<pre class="fssnip">
<span class="l">167: </span><span class="prep">#I</span> <span class="s">"</span><span class="s">lib</span><span class="s">"</span>
<span class="l">168: </span><span class="prep">#r</span> <span class="s">"</span><span class="s">Microsoft</span><span class="s">.</span><span class="s">Solver</span><span class="s">.</span><span class="s">Foundation</span><span class="s">.</span><span class="s">dll</span><span class="s">"</span>
<span class="l">169: </span><span class="k">open</span> <span class="i" onmouseover="showTip(event, 'fstips150', 498)" onmouseout="hideTip(event, 'fstips150', 498)">Microsoft</span><span class="o">.</span><span class="i">SolverFoundation</span><span class="o">.</span><span class="i">Common</span>
<span class="l">170: </span><span class="k">open</span> <span class="i" onmouseover="showTip(event, 'fstips150', 499)" onmouseout="hideTip(event, 'fstips150', 499)">Microsoft</span><span class="o">.</span><span class="i">SolverFoundation</span><span class="o">.</span><span class="i">Solvers</span>
<span class="l">171: </span><span class="k">open</span> <span class="i" onmouseover="showTip(event, 'fstips150', 500)" onmouseout="hideTip(event, 'fstips150', 500)">Microsoft</span><span class="o">.</span><span class="i">SolverFoundation</span><span class="o">.</span><span class="i">Services</span>
<span class="l">172: </span>
<span class="l">173: </span><span class="c">//</span><span class="c"> </span><span class="c">This</span><span class="c"> </span><span class="c">wrapper</span><span class="c"> </span><span class="c">comes</span><span class="c"> </span><span class="c">with</span><span class="c"> </span><span class="c">Solver</span><span class="c"> </span><span class="c">Foundation</span><span class="c"> </span><span class="c">in</span><span class="c"> </span><span class="c">the</span><span class="c"> </span><span class="c">F#</span><span class="c"> </span><span class="c">Samples</span>
<span class="l">174: </span><span class="prep">#load</span> <span class="s">"</span><span class="s">SfsWrapper</span><span class="s">.</span><span class="s">fsx</span><span class="s">"</span>
<span class="l">175: </span><span class="k">open</span> <span class="i" onmouseover="showTip(event, 'fstips151', 501)" onmouseout="hideTip(event, 'fstips151', 501)">SfsWrapper</span>
<span class="l">176: </span>
<span class="l">177: </span><span class="c">//</span><span class="c"> </span><span class="c">these</span><span class="c"> </span><span class="c">measure</span><span class="c"> </span><span class="c">types</span><span class="c"> </span><span class="c">aren't</span><span class="c"> </span><span class="c">necessary</span><span class="c"> </span><span class="c">for</span><span class="c"> </span><span class="c">this</span><span class="c"> </span><span class="c">example</span><span class="c"> </span><span class="c">but</span><span class="c"> </span><span class="c">were</span><span class="c"> </span>
<span class="l">178: </span><span class="c">//</span><span class="c"> </span><span class="c">used</span><span class="c"> </span><span class="c">to</span><span class="c"> </span><span class="c">make</span><span class="c"> </span><span class="c">it</span><span class="c"> </span><span class="c">easier</span><span class="c"> </span><span class="c">to</span><span class="c"> </span><span class="c">keep</span><span class="c"> </span><span class="c">track</span><span class="c"> </span><span class="c">of</span><span class="c"> </span><span class="c">what</span><span class="c"> </span><span class="c">the</span><span class="c"> </span><span class="c">variables</span><span class="c"> </span><span class="c">in</span><span class="c"> </span><span class="c">the</span><span class="c"> </span>
<span class="l">179: </span><span class="c">//</span><span class="c"> </span><span class="c">drake</span><span class="c"> </span><span class="c">equation</span><span class="c"> </span><span class="c">stand</span><span class="c"> </span><span class="c">for.</span>
<span class="l">180: </span>[&lt;<span class="i" onmouseover="showTip(event, 'fstips152', 502)" onmouseout="hideTip(event, 'fstips152', 502)">Measure</span>&gt;] <span class="k">type</span> <span class="i" onmouseover="showTip(event, 'fstips153', 503)" onmouseout="hideTip(event, 'fstips153', 503)">Year</span>
<span class="l">181: </span>[&lt;<span class="i" onmouseover="showTip(event, 'fstips152', 504)" onmouseout="hideTip(event, 'fstips152', 504)">Measure</span>&gt;] <span class="k">type</span> <span class="i" onmouseover="showTip(event, 'fstips154', 505)" onmouseout="hideTip(event, 'fstips154', 505)">Star</span>
<span class="l">182: </span>[&lt;<span class="i" onmouseover="showTip(event, 'fstips152', 506)" onmouseout="hideTip(event, 'fstips152', 506)">Measure</span>&gt;] <span class="k">type</span> <span class="i" onmouseover="showTip(event, 'fstips155', 507)" onmouseout="hideTip(event, 'fstips155', 507)">Planet</span>
<span class="l">183: </span>[&lt;<span class="i" onmouseover="showTip(event, 'fstips152', 508)" onmouseout="hideTip(event, 'fstips152', 508)">Measure</span>&gt;] <span class="k">type</span> <span class="i" onmouseover="showTip(event, 'fstips156', 509)" onmouseout="hideTip(event, 'fstips156', 509)">LifeCapible</span> <span class="o">=</span> <span class="i" onmouseover="showTip(event, 'fstips155', 510)" onmouseout="hideTip(event, 'fstips155', 510)">Planet</span> <span class="o">/</span> <span class="i" onmouseover="showTip(event, 'fstips155', 511)" onmouseout="hideTip(event, 'fstips155', 511)">Planet</span> <span class="o">/</span> <span class="i" onmouseover="showTip(event, 'fstips154', 512)" onmouseout="hideTip(event, 'fstips154', 512)">Star</span>
<span class="l">184: </span>[&lt;<span class="i" onmouseover="showTip(event, 'fstips152', 513)" onmouseout="hideTip(event, 'fstips152', 513)">Measure</span>&gt;] <span class="k">type</span> <span class="i" onmouseover="showTip(event, 'fstips157', 514)" onmouseout="hideTip(event, 'fstips157', 514)">Life</span> <span class="o">=</span> <span class="i" onmouseover="showTip(event, 'fstips155', 515)" onmouseout="hideTip(event, 'fstips155', 515)">Planet</span> <span class="o">/</span> <span class="i" onmouseover="showTip(event, 'fstips156', 516)" onmouseout="hideTip(event, 'fstips156', 516)">LifeCapible</span>
<span class="l">185: </span>[&lt;<span class="i" onmouseover="showTip(event, 'fstips152', 517)" onmouseout="hideTip(event, 'fstips152', 517)">Measure</span>&gt;] <span class="k">type</span> <span class="i" onmouseover="showTip(event, 'fstips158', 518)" onmouseout="hideTip(event, 'fstips158', 518)">IntelligentLife</span> <span class="o">=</span> <span class="i" onmouseover="showTip(event, 'fstips155', 519)" onmouseout="hideTip(event, 'fstips155', 519)">Planet</span> <span class="o">/</span> <span class="i" onmouseover="showTip(event, 'fstips157', 520)" onmouseout="hideTip(event, 'fstips157', 520)">Life</span>
<span class="l">186: </span>[&lt;<span class="i" onmouseover="showTip(event, 'fstips152', 521)" onmouseout="hideTip(event, 'fstips152', 521)">Measure</span>&gt;] <span class="k">type</span> <span class="i" onmouseover="showTip(event, 'fstips159', 522)" onmouseout="hideTip(event, 'fstips159', 522)">CommunicatingIntelligentLife</span> <span class="o">=</span> <span class="i" onmouseover="showTip(event, 'fstips155', 523)" onmouseout="hideTip(event, 'fstips155', 523)">Planet</span> <span class="o">/</span> <span class="i" onmouseover="showTip(event, 'fstips158', 524)" onmouseout="hideTip(event, 'fstips158', 524)">IntelligentLife</span>
<span class="l">187: </span>[&lt;<span class="i" onmouseover="showTip(event, 'fstips152', 525)" onmouseout="hideTip(event, 'fstips152', 525)">Measure</span>&gt;] <span class="k">type</span> <span class="i" onmouseover="showTip(event, 'fstips160', 526)" onmouseout="hideTip(event, 'fstips160', 526)">Civilization</span>
<span class="l">188: </span>
<span class="l">189: </span><span class="k">let</span> <span class="i" onmouseover="showTip(event, 'fstips161', 527)" onmouseout="hideTip(event, 'fstips161', 527)">context</span> <span class="o">=</span> <span class="i">SolverContext</span><span class="o">.</span><span class="i">GetContext</span>()
<span class="l">190: </span><span class="k">let</span> <span class="i" onmouseover="showTip(event, 'fstips162', 528)" onmouseout="hideTip(event, 'fstips162', 528)">drake</span>   <span class="o">=</span> <span class="i" onmouseover="showTip(event, 'fstips163', 529)" onmouseout="hideTip(event, 'fstips163', 529)">SfsModel</span>(<span class="i" onmouseover="showTip(event, 'fstips161', 530)" onmouseout="hideTip(event, 'fstips161', 530)">context</span>)
<span class="l">191: </span>
<span class="l">192: </span><span class="c">//</span><span class="c"> </span><span class="c">optimization</span><span class="c"> </span><span class="c">variables</span>
<span class="l">193: </span><span class="k">let</span> <span class="i" onmouseover="showTip(event, 'fstips164', 531)" onmouseout="hideTip(event, 'fstips164', 531)">R</span>  <span class="o">=</span> <span class="i" onmouseover="showTip(event, 'fstips162', 532)" onmouseout="hideTip(event, 'fstips162', 532)">drake</span><span class="o">.</span><span class="i" onmouseover="showTip(event, 'fstips165', 533)" onmouseout="hideTip(event, 'fstips165', 533)">CreateRealVariable</span><span class="o">&lt;</span><span class="i" onmouseover="showTip(event, 'fstips154', 534)" onmouseout="hideTip(event, 'fstips154', 534)">Star</span><span class="o">/</span><span class="i" onmouseover="showTip(event, 'fstips153', 535)" onmouseout="hideTip(event, 'fstips153', 535)">Year</span><span class="o">&gt;</span>()
<span class="l">194: </span><span class="k">let</span> <span class="i" onmouseover="showTip(event, 'fstips166', 536)" onmouseout="hideTip(event, 'fstips166', 536)">fp</span> <span class="o">=</span> <span class="i" onmouseover="showTip(event, 'fstips162', 537)" onmouseout="hideTip(event, 'fstips162', 537)">drake</span><span class="o">.</span><span class="i" onmouseover="showTip(event, 'fstips165', 538)" onmouseout="hideTip(event, 'fstips165', 538)">CreateRealVariable</span><span class="o">&lt;</span><span class="i" onmouseover="showTip(event, 'fstips155', 539)" onmouseout="hideTip(event, 'fstips155', 539)">Planet</span><span class="o">/</span><span class="i" onmouseover="showTip(event, 'fstips154', 540)" onmouseout="hideTip(event, 'fstips154', 540)">Star</span><span class="o">&gt;</span>()
<span class="l">195: </span><span class="k">let</span> <span class="i" onmouseover="showTip(event, 'fstips167', 541)" onmouseout="hideTip(event, 'fstips167', 541)">ne</span> <span class="o">=</span> <span class="i" onmouseover="showTip(event, 'fstips162', 542)" onmouseout="hideTip(event, 'fstips162', 542)">drake</span><span class="o">.</span><span class="i" onmouseover="showTip(event, 'fstips165', 543)" onmouseout="hideTip(event, 'fstips165', 543)">CreateRealVariable</span><span class="o">&lt;</span><span class="i" onmouseover="showTip(event, 'fstips156', 544)" onmouseout="hideTip(event, 'fstips156', 544)">LifeCapible</span><span class="o">&gt;</span>()
<span class="l">196: </span><span class="k">let</span> <span class="i" onmouseover="showTip(event, 'fstips168', 545)" onmouseout="hideTip(event, 'fstips168', 545)">fl</span> <span class="o">=</span> <span class="i" onmouseover="showTip(event, 'fstips162', 546)" onmouseout="hideTip(event, 'fstips162', 546)">drake</span><span class="o">.</span><span class="i" onmouseover="showTip(event, 'fstips165', 547)" onmouseout="hideTip(event, 'fstips165', 547)">CreateRealVariable</span><span class="o">&lt;</span><span class="i" onmouseover="showTip(event, 'fstips157', 548)" onmouseout="hideTip(event, 'fstips157', 548)">Life</span><span class="o">&gt;</span>()
<span class="l">197: </span><span class="k">let</span> <span class="i" onmouseover="showTip(event, 'fstips169', 549)" onmouseout="hideTip(event, 'fstips169', 549)">fi</span> <span class="o">=</span> <span class="i" onmouseover="showTip(event, 'fstips162', 550)" onmouseout="hideTip(event, 'fstips162', 550)">drake</span><span class="o">.</span><span class="i" onmouseover="showTip(event, 'fstips165', 551)" onmouseout="hideTip(event, 'fstips165', 551)">CreateRealVariable</span><span class="o">&lt;</span><span class="i" onmouseover="showTip(event, 'fstips158', 552)" onmouseout="hideTip(event, 'fstips158', 552)">IntelligentLife</span><span class="o">&gt;</span>()
<span class="l">198: </span><span class="k">let</span> <span class="i" onmouseover="showTip(event, 'fstips170', 553)" onmouseout="hideTip(event, 'fstips170', 553)">fc</span> <span class="o">=</span> <span class="i" onmouseover="showTip(event, 'fstips162', 554)" onmouseout="hideTip(event, 'fstips162', 554)">drake</span><span class="o">.</span><span class="i" onmouseover="showTip(event, 'fstips165', 555)" onmouseout="hideTip(event, 'fstips165', 555)">CreateRealVariable</span><span class="o">&lt;</span><span class="i" onmouseover="showTip(event, 'fstips159', 556)" onmouseout="hideTip(event, 'fstips159', 556)">CommunicatingIntelligentLife</span><span class="o">&gt;</span>()
<span class="l">199: </span><span class="k">let</span> <span class="i" onmouseover="showTip(event, 'fstips171', 557)" onmouseout="hideTip(event, 'fstips171', 557)">L</span>  <span class="o">=</span> <span class="i" onmouseover="showTip(event, 'fstips162', 558)" onmouseout="hideTip(event, 'fstips162', 558)">drake</span><span class="o">.</span><span class="i" onmouseover="showTip(event, 'fstips165', 559)" onmouseout="hideTip(event, 'fstips165', 559)">CreateRealVariable</span><span class="o">&lt;</span><span class="i" onmouseover="showTip(event, 'fstips153', 560)" onmouseout="hideTip(event, 'fstips153', 560)">Year</span><span class="o">&gt;</span>()
<span class="l">200: </span><span class="k">let</span> <span class="i" onmouseover="showTip(event, 'fstips172', 561)" onmouseout="hideTip(event, 'fstips172', 561)">N</span>  <span class="o">=</span> <span class="i" onmouseover="showTip(event, 'fstips162', 562)" onmouseout="hideTip(event, 'fstips162', 562)">drake</span><span class="o">.</span><span class="i" onmouseover="showTip(event, 'fstips165', 563)" onmouseout="hideTip(event, 'fstips165', 563)">CreateRealVariable</span><span class="o">&lt;</span><span class="i" onmouseover="showTip(event, 'fstips159', 564)" onmouseout="hideTip(event, 'fstips159', 564)">CommunicatingIntelligentLife</span> 
<span class="l">201: </span>                                    <span class="i" onmouseover="showTip(event, 'fstips158', 565)" onmouseout="hideTip(event, 'fstips158', 565)">IntelligentLife</span> <span class="i" onmouseover="showTip(event, 'fstips157', 566)" onmouseout="hideTip(event, 'fstips157', 566)">Life</span> 
<span class="l">202: </span>                                      <span class="i" onmouseover="showTip(event, 'fstips156', 567)" onmouseout="hideTip(event, 'fstips156', 567)">LifeCapible</span> <span class="i" onmouseover="showTip(event, 'fstips155', 568)" onmouseout="hideTip(event, 'fstips155', 568)">Planet</span><span class="o">&gt;</span>()
<span class="l">203: </span>
<span class="l">204: </span><span class="c">//</span><span class="c"> </span><span class="c">none</span><span class="c"> </span><span class="c">of</span><span class="c"> </span><span class="c">these</span><span class="c"> </span><span class="c">should</span><span class="c"> </span><span class="c">dip</span><span class="c"> </span><span class="c">below</span><span class="c"> </span><span class="c">0.0</span>
<span class="l">205: </span><span class="i" onmouseover="showTip(event, 'fstips162', 569)" onmouseout="hideTip(event, 'fstips162', 569)">drake</span><span class="o">.</span><span class="i" onmouseover="showTip(event, 'fstips173', 570)" onmouseout="hideTip(event, 'fstips173', 570)">AddConstraints</span> [|
<span class="l">206: </span>  <span class="n">0.0</span><span class="o">&lt;</span>_<span class="o">&gt;</span> <span class="o">&lt;&lt;==</span> <span class="i" onmouseover="showTip(event, 'fstips164', 571)" onmouseout="hideTip(event, 'fstips164', 571)">R</span>;  <span class="n">0.0</span><span class="o">&lt;</span>_<span class="o">&gt;</span> <span class="o">&lt;&lt;==</span> <span class="i" onmouseover="showTip(event, 'fstips166', 572)" onmouseout="hideTip(event, 'fstips166', 572)">fp</span>; <span class="n">0.0</span><span class="o">&lt;</span>_<span class="o">&gt;</span> <span class="o">&lt;&lt;==</span> <span class="i" onmouseover="showTip(event, 'fstips167', 573)" onmouseout="hideTip(event, 'fstips167', 573)">ne</span>; <span class="n">0.0</span><span class="o">&lt;</span>_<span class="o">&gt;</span> <span class="o">&lt;&lt;==</span> <span class="i" onmouseover="showTip(event, 'fstips168', 574)" onmouseout="hideTip(event, 'fstips168', 574)">fl</span>;
<span class="l">207: </span>  <span class="n">0.0</span><span class="o">&lt;</span>_<span class="o">&gt;</span> <span class="o">&lt;&lt;==</span> <span class="i" onmouseover="showTip(event, 'fstips169', 575)" onmouseout="hideTip(event, 'fstips169', 575)">fi</span>; <span class="n">0.0</span><span class="o">&lt;</span>_<span class="o">&gt;</span> <span class="o">&lt;&lt;==</span> <span class="i" onmouseover="showTip(event, 'fstips170', 576)" onmouseout="hideTip(event, 'fstips170', 576)">fc</span>; <span class="n">0.0</span><span class="o">&lt;</span>_<span class="o">&gt;</span> <span class="o">&lt;&lt;==</span> <span class="i" onmouseover="showTip(event, 'fstips171', 577)" onmouseout="hideTip(event, 'fstips171', 577)">L</span>;  <span class="n">1.0</span><span class="o">&lt;</span>_<span class="o">&gt;</span> <span class="o">====</span> <span class="i" onmouseover="showTip(event, 'fstips172', 578)" onmouseout="hideTip(event, 'fstips172', 578)">N</span>
<span class="l">208: </span>|]
<span class="l">209: </span>
<span class="l">210: </span><span class="k">let</span> <span class="i" onmouseover="showTip(event, 'fstips174', 579)" onmouseout="hideTip(event, 'fstips174', 579)">cR</span>  <span class="o">=</span> <span class="i" onmouseover="showTip(event, 'fstips162', 580)" onmouseout="hideTip(event, 'fstips162', 580)">drake</span><span class="o">.</span><span class="i" onmouseover="showTip(event, 'fstips175', 581)" onmouseout="hideTip(event, 'fstips175', 581)">AddConstraint</span> ( <span class="i" onmouseover="showTip(event, 'fstips164', 582)" onmouseout="hideTip(event, 'fstips164', 582)">R</span>  <span class="o">====</span>   <span class="n">7.0</span><span class="o">&lt;</span>_<span class="o">&gt;</span> )
<span class="l">211: </span><span class="k">let</span> <span class="i" onmouseover="showTip(event, 'fstips176', 583)" onmouseout="hideTip(event, 'fstips176', 583)">cfp</span> <span class="o">=</span> <span class="i" onmouseover="showTip(event, 'fstips162', 584)" onmouseout="hideTip(event, 'fstips162', 584)">drake</span><span class="o">.</span><span class="i" onmouseover="showTip(event, 'fstips175', 585)" onmouseout="hideTip(event, 'fstips175', 585)">AddConstraint</span> ( <span class="i" onmouseover="showTip(event, 'fstips166', 586)" onmouseout="hideTip(event, 'fstips166', 586)">fp</span> <span class="o">&lt;&lt;==</span>   <span class="n">8.0</span><span class="o">&lt;</span>_<span class="o">&gt;</span> )
<span class="l">212: </span><span class="k">let</span> <span class="i" onmouseover="showTip(event, 'fstips177', 587)" onmouseout="hideTip(event, 'fstips177', 587)">cne</span> <span class="o">=</span> <span class="i" onmouseover="showTip(event, 'fstips162', 588)" onmouseout="hideTip(event, 'fstips162', 588)">drake</span><span class="o">.</span><span class="i" onmouseover="showTip(event, 'fstips175', 589)" onmouseout="hideTip(event, 'fstips175', 589)">AddConstraint</span> ( <span class="i" onmouseover="showTip(event, 'fstips167', 590)" onmouseout="hideTip(event, 'fstips167', 590)">ne</span> <span class="o">&lt;&lt;==</span>   <span class="n">1.0</span><span class="o">&lt;</span>_<span class="o">&gt;</span> )
<span class="l">213: </span><span class="k">let</span> <span class="i" onmouseover="showTip(event, 'fstips178', 591)" onmouseout="hideTip(event, 'fstips178', 591)">cfl</span> <span class="o">=</span> <span class="i" onmouseover="showTip(event, 'fstips162', 592)" onmouseout="hideTip(event, 'fstips162', 592)">drake</span><span class="o">.</span><span class="i" onmouseover="showTip(event, 'fstips175', 593)" onmouseout="hideTip(event, 'fstips175', 593)">AddConstraint</span> ( <span class="i" onmouseover="showTip(event, 'fstips168', 594)" onmouseout="hideTip(event, 'fstips168', 594)">fl</span> <span class="o">&lt;&lt;==</span>   <span class="n">1.0</span><span class="o">&lt;</span>_<span class="o">&gt;</span> )
<span class="l">214: </span><span class="k">let</span> <span class="i" onmouseover="showTip(event, 'fstips179', 595)" onmouseout="hideTip(event, 'fstips179', 595)">cfi</span> <span class="o">=</span> <span class="i" onmouseover="showTip(event, 'fstips162', 596)" onmouseout="hideTip(event, 'fstips162', 596)">drake</span><span class="o">.</span><span class="i" onmouseover="showTip(event, 'fstips175', 597)" onmouseout="hideTip(event, 'fstips175', 597)">AddConstraint</span> ( <span class="i" onmouseover="showTip(event, 'fstips169', 598)" onmouseout="hideTip(event, 'fstips169', 598)">fi</span> <span class="o">&lt;&lt;==</span>   <span class="n">1.0</span><span class="o">&lt;</span>_<span class="o">&gt;</span> )
<span class="l">215: </span><span class="k">let</span> <span class="i" onmouseover="showTip(event, 'fstips180', 599)" onmouseout="hideTip(event, 'fstips180', 599)">cfc</span> <span class="o">=</span> <span class="i" onmouseover="showTip(event, 'fstips162', 600)" onmouseout="hideTip(event, 'fstips162', 600)">drake</span><span class="o">.</span><span class="i" onmouseover="showTip(event, 'fstips175', 601)" onmouseout="hideTip(event, 'fstips175', 601)">AddConstraint</span> ( <span class="i" onmouseover="showTip(event, 'fstips170', 602)" onmouseout="hideTip(event, 'fstips170', 602)">fc</span> <span class="o">&lt;&lt;==</span>   <span class="n">1.0</span><span class="o">&lt;</span>_<span class="o">&gt;</span> )
<span class="l">216: </span><span class="k">let</span> <span class="i" onmouseover="showTip(event, 'fstips181', 603)" onmouseout="hideTip(event, 'fstips181', 603)">cL</span>  <span class="o">=</span> <span class="i" onmouseover="showTip(event, 'fstips162', 604)" onmouseout="hideTip(event, 'fstips162', 604)">drake</span><span class="o">.</span><span class="i" onmouseover="showTip(event, 'fstips175', 605)" onmouseout="hideTip(event, 'fstips175', 605)">AddConstraint</span> ( <span class="i" onmouseover="showTip(event, 'fstips171', 606)" onmouseout="hideTip(event, 'fstips171', 606)">L</span>  <span class="o">&lt;&lt;==</span> <span class="n">304.0</span><span class="o">&lt;</span>_<span class="o">&gt;</span> )
<span class="l">217: </span><span class="k">let</span> <span class="i" onmouseover="showTip(event, 'fstips182', 607)" onmouseout="hideTip(event, 'fstips182', 607)">cN</span>  <span class="o">=</span> <span class="i" onmouseover="showTip(event, 'fstips162', 608)" onmouseout="hideTip(event, 'fstips162', 608)">drake</span><span class="o">.</span><span class="i" onmouseover="showTip(event, 'fstips175', 609)" onmouseout="hideTip(event, 'fstips175', 609)">AddConstraint</span> ( <span class="i" onmouseover="showTip(event, 'fstips172', 610)" onmouseout="hideTip(event, 'fstips172', 610)">N</span>  <span class="o">====</span> <span class="i" onmouseover="showTip(event, 'fstips164', 611)" onmouseout="hideTip(event, 'fstips164', 611)">R</span> <span class="o">*</span> <span class="i" onmouseover="showTip(event, 'fstips166', 612)" onmouseout="hideTip(event, 'fstips166', 612)">fp</span> <span class="o">*</span> <span class="i" onmouseover="showTip(event, 'fstips167', 613)" onmouseout="hideTip(event, 'fstips167', 613)">ne</span> <span class="o">*</span> <span class="i" onmouseover="showTip(event, 'fstips168', 614)" onmouseout="hideTip(event, 'fstips168', 614)">fl</span> <span class="o">*</span> <span class="i" onmouseover="showTip(event, 'fstips169', 615)" onmouseout="hideTip(event, 'fstips169', 615)">fi</span> <span class="o">*</span> <span class="i" onmouseover="showTip(event, 'fstips170', 616)" onmouseout="hideTip(event, 'fstips170', 616)">fc</span> <span class="o">*</span> <span class="i" onmouseover="showTip(event, 'fstips171', 617)" onmouseout="hideTip(event, 'fstips171', 617)">L</span> )
<span class="l">218: </span>
<span class="l">219: </span><span class="k">let</span> <span class="i" onmouseover="showTip(event, 'fstips183', 618)" onmouseout="hideTip(event, 'fstips183', 618)">minimumLifeCapible</span> <span class="o">=</span> <span class="i" onmouseover="showTip(event, 'fstips162', 619)" onmouseout="hideTip(event, 'fstips162', 619)">drake</span><span class="o">.</span><span class="i" onmouseover="showTip(event, 'fstips184', 620)" onmouseout="hideTip(event, 'fstips184', 620)">AddGoal</span>( <span class="i">GoalKind</span><span class="o">.</span><span class="i">Minimize</span>,
<span class="l">220: </span>                                        <span class="i" onmouseover="showTip(event, 'fstips164', 621)" onmouseout="hideTip(event, 'fstips164', 621)">R</span> <span class="o">*</span> <span class="i" onmouseover="showTip(event, 'fstips166', 622)" onmouseout="hideTip(event, 'fstips166', 622)">fp</span> <span class="o">*</span> <span class="i" onmouseover="showTip(event, 'fstips167', 623)" onmouseout="hideTip(event, 'fstips167', 623)">ne</span> <span class="o">*</span> <span class="i" onmouseover="showTip(event, 'fstips168', 624)" onmouseout="hideTip(event, 'fstips168', 624)">fl</span> <span class="o">*</span> <span class="i" onmouseover="showTip(event, 'fstips169', 625)" onmouseout="hideTip(event, 'fstips169', 625)">fi</span> <span class="o">*</span> <span class="i" onmouseover="showTip(event, 'fstips170', 626)" onmouseout="hideTip(event, 'fstips170', 626)">fc</span> <span class="o">*</span> <span class="i" onmouseover="showTip(event, 'fstips171', 627)" onmouseout="hideTip(event, 'fstips171', 627)">L</span> )
<span class="l">221: </span>
<span class="l">222: </span><span class="c">//</span><span class="c">drake.RemoveGoal(minimumLifeCapible)</span>
<span class="l">223: </span><span class="k">let</span> <span class="i" onmouseover="showTip(event, 'fstips185', 628)" onmouseout="hideTip(event, 'fstips185', 628)">solution</span> <span class="o">=</span> <span class="i" onmouseover="showTip(event, 'fstips162', 629)" onmouseout="hideTip(event, 'fstips162', 629)">drake</span><span class="o">.</span><span class="i" onmouseover="showTip(event, 'fstips186', 630)" onmouseout="hideTip(event, 'fstips186', 630)">Solve</span>(<span class="i" onmouseover="showTip(event, 'fstips187', 631)" onmouseout="hideTip(event, 'fstips187', 631)">LocalSearch</span>)
<span class="l">224: </span>
<span class="l">225: </span><span class="c">//</span><span class="c"> </span><span class="c">see</span><span class="c"> </span><span class="c">the</span><span class="c"> </span><span class="c">results</span>
<span class="l">226: </span><span class="c">//</span><span class="c"> </span><span class="c">val</span><span class="c"> </span><span class="c">it</span><span class="c"> </span><span class="c">:</span><span class="c"> </span><span class="c">SolverQuality</span><span class="c"> </span><span class="c">=</span><span class="c"> </span><span class="c">LocalOptimal</span>
<span class="l">227: </span><span class="i" onmouseover="showTip(event, 'fstips185', 632)" onmouseout="hideTip(event, 'fstips185', 632)">solution</span><span class="o">.</span><span class="i">Quality</span>
<span class="l">228: </span><span class="c">//</span><span class="c"> </span><span class="c">val</span><span class="c"> </span><span class="c">it</span><span class="c"> </span><span class="c">:</span><span class="c"> </span><span class="c">R</span><span class="c">  </span><span class="c">=</span><span class="c"> </span><span class="c">7.0</span>
<span class="l">229: </span><span class="i" onmouseover="showTip(event, 'fstips164', 633)" onmouseout="hideTip(event, 'fstips164', 633)">R</span><span class="o">.</span><span class="i">Value</span>  <span class="o">|&gt;</span> <span class="i" onmouseover="showTip(event, 'fstips95', 634)" onmouseout="hideTip(event, 'fstips95', 634)">float</span>
<span class="l">230: </span><span class="c">//</span><span class="c"> </span><span class="c">val</span><span class="c"> </span><span class="c">it</span><span class="c"> </span><span class="c">:</span><span class="c"> </span><span class="c">fp</span><span class="c"> </span><span class="c">=</span><span class="c"> </span><span class="c">4.341172079</span>
<span class="l">231: </span><span class="i" onmouseover="showTip(event, 'fstips166', 635)" onmouseout="hideTip(event, 'fstips166', 635)">fp</span><span class="o">.</span><span class="i">Value</span> <span class="o">|&gt;</span> <span class="i" onmouseover="showTip(event, 'fstips95', 636)" onmouseout="hideTip(event, 'fstips95', 636)">float</span>
<span class="l">232: </span><span class="c">//</span><span class="c"> </span><span class="c">val</span><span class="c"> </span><span class="c">it</span><span class="c"> </span><span class="c">:</span><span class="c"> </span><span class="c">ne</span><span class="c"> </span><span class="c">=</span><span class="c"> </span><span class="c">0.06266237088</span>
<span class="l">233: </span><span class="i" onmouseover="showTip(event, 'fstips167', 637)" onmouseout="hideTip(event, 'fstips167', 637)">ne</span><span class="o">.</span><span class="i">Value</span> <span class="o">|&gt;</span> <span class="i" onmouseover="showTip(event, 'fstips95', 638)" onmouseout="hideTip(event, 'fstips95', 638)">float</span>
<span class="l">234: </span><span class="c">//</span><span class="c"> </span><span class="c">val</span><span class="c"> </span><span class="c">it</span><span class="c"> </span><span class="c">:</span><span class="c"> </span><span class="c">fl</span><span class="c"> </span><span class="c">=</span><span class="c"> </span><span class="c">0.0303299242</span>
<span class="l">235: </span><span class="i" onmouseover="showTip(event, 'fstips168', 639)" onmouseout="hideTip(event, 'fstips168', 639)">fl</span><span class="o">.</span><span class="i">Value</span> <span class="o">|&gt;</span> <span class="i" onmouseover="showTip(event, 'fstips95', 640)" onmouseout="hideTip(event, 'fstips95', 640)">float</span>
<span class="l">236: </span><span class="c">//</span><span class="c"> </span><span class="c">val</span><span class="c"> </span><span class="c">it</span><span class="c"> </span><span class="c">:</span><span class="c"> </span><span class="c">fi</span><span class="c"> </span><span class="c">=</span><span class="c"> </span><span class="c">0.1318182999</span>
<span class="l">237: </span><span class="i" onmouseover="showTip(event, 'fstips169', 641)" onmouseout="hideTip(event, 'fstips169', 641)">fi</span><span class="o">.</span><span class="i">Value</span> <span class="o">|&gt;</span> <span class="i" onmouseover="showTip(event, 'fstips95', 642)" onmouseout="hideTip(event, 'fstips95', 642)">float</span>
<span class="l">238: </span><span class="c">//</span><span class="c"> </span><span class="c">val</span><span class="c"> </span><span class="c">it</span><span class="c"> </span><span class="c">:</span><span class="c"> </span><span class="c">fc</span><span class="c"> </span><span class="c">=</span><span class="c"> </span><span class="c">0.7418663017</span>
<span class="l">239: </span><span class="i" onmouseover="showTip(event, 'fstips170', 643)" onmouseout="hideTip(event, 'fstips170', 643)">fc</span><span class="o">.</span><span class="i">Value</span> <span class="o">|&gt;</span> <span class="i" onmouseover="showTip(event, 'fstips95', 644)" onmouseout="hideTip(event, 'fstips95', 644)">float</span>
<span class="l">240: </span><span class="c">//</span><span class="c"> </span><span class="c">val</span><span class="c"> </span><span class="c">it</span><span class="c"> </span><span class="c">:</span><span class="c"> </span><span class="c">L</span><span class="c">  </span><span class="c">=</span><span class="c"> </span><span class="c">177.0579602</span>
<span class="l">241: </span><span class="i" onmouseover="showTip(event, 'fstips171', 645)" onmouseout="hideTip(event, 'fstips171', 645)">L</span><span class="o">.</span><span class="i">Value</span>  <span class="o">|&gt;</span> <span class="i" onmouseover="showTip(event, 'fstips95', 646)" onmouseout="hideTip(event, 'fstips95', 646)">float</span>
<span class="l">242: </span><span class="c">//</span><span class="c"> </span><span class="c">val</span><span class="c"> </span><span class="c">it</span><span class="c"> </span><span class="c">:</span><span class="c"> </span><span class="c">N</span><span class="c">  </span><span class="c">=</span><span class="c"> </span><span class="c">0.99999999</span>
<span class="l">243: </span><span class="i" onmouseover="showTip(event, 'fstips172', 647)" onmouseout="hideTip(event, 'fstips172', 647)">N</span><span class="o">.</span><span class="i">Value</span>  <span class="o">|&gt;</span> <span class="i" onmouseover="showTip(event, 'fstips95', 648)" onmouseout="hideTip(event, 'fstips95', 648)">float</span><a class="fssniplink" href="http://tomasp.net/fswebsnippets" target="_blank">F# Web Snippets</a></pre>
<!-- HTML code for ToolTips -->
<div id="fstips1" class="tip">namespace System</div>
<div id="fstips2" class="tip">namespace System.IO</div>
<div id="fstips3" class="tip">namespace System.Reflection</div>
<div id="fstips4" class="tip">

type Info =
| Types of Type
| Fields of FieldInfo
| Properties of PropertyInfo
| Events of EventInfo
| Methods of MethodInfo
| Constructors of ConstructorInfo

Full name: Arrow-Notation-via-FSharp.Reflect.Info

type: Info
implements: IEquatable&lt;Info&gt;
implements: Collections.IStructuralEquatable

</div>
<div id="fstips5" class="tip">union case Info.Types: Type -&gt; Info</div>
<div id="fstips6" class="tip">

type Type =
class
inherit System.Reflection.MemberInfo
member Assembly : System.Reflection.Assembly
member AssemblyQualifiedName : string
member Attributes : System.Reflection.TypeAttributes
member BaseType : System.Type
member ContainsGenericParameters : bool
member DeclaringMethod : System.Reflection.MethodBase
member DeclaringType : System.Type
member Equals : obj -&gt; bool
member Equals : System.Type -&gt; bool
member FindInterfaces : System.Reflection.TypeFilter * obj -&gt; System.Type []
member FindMembers : System.Reflection.MemberTypes * System.Reflection.BindingFlags * System.Reflection.MemberFilter * obj -&gt; System.Reflection.MemberInfo []
member FullName : string
member GUID : System.Guid
member GenericParameterAttributes : System.Reflection.GenericParameterAttributes
member GenericParameterPosition : int
member GetArrayRank : unit -&gt; int
member GetConstructor : System.Type [] -&gt; System.Reflection.ConstructorInfo
member GetConstructor : System.Reflection.BindingFlags * System.Reflection.Binder * System.Type [] * System.Reflection.ParameterModifier [] -&gt; System.Reflection.ConstructorInfo
member GetConstructor : System.Reflection.BindingFlags * System.Reflection.Binder * System.Reflection.CallingConventions * System.Type [] * System.Reflection.ParameterModifier [] -&gt; System.Reflection.ConstructorInfo
member GetConstructors : unit -&gt; System.Reflection.ConstructorInfo []
member GetConstructors : System.Reflection.BindingFlags -&gt; System.Reflection.ConstructorInfo []
member GetDefaultMembers : unit -&gt; System.Reflection.MemberInfo []
member GetElementType : unit -&gt; System.Type
member GetEnumName : obj -&gt; string
member GetEnumNames : unit -&gt; string []
member GetEnumUnderlyingType : unit -&gt; System.Type
member GetEnumValues : unit -&gt; System.Array
member GetEvent : string -&gt; System.Reflection.EventInfo
member GetEvent : string * System.Reflection.BindingFlags -&gt; System.Reflection.EventInfo
member GetEvents : unit -&gt; System.Reflection.EventInfo []
member GetEvents : System.Reflection.BindingFlags -&gt; System.Reflection.EventInfo []
member GetField : string -&gt; System.Reflection.FieldInfo
member GetField : string * System.Reflection.BindingFlags -&gt; System.Reflection.FieldInfo
member GetFields : unit -&gt; System.Reflection.FieldInfo []
member GetFields : System.Reflection.BindingFlags -&gt; System.Reflection.FieldInfo []
member GetGenericArguments : unit -&gt; System.Type []
member GetGenericParameterConstraints : unit -&gt; System.Type []
member GetGenericTypeDefinition : unit -&gt; System.Type
member GetHashCode : unit -&gt; int
member GetInterface : string -&gt; System.Type
member GetInterface : string * bool -&gt; System.Type
member GetInterfaceMap : System.Type -&gt; System.Reflection.InterfaceMapping
member GetInterfaces : unit -&gt; System.Type []
member GetMember : string -&gt; System.Reflection.MemberInfo []
member GetMember : string * System.Reflection.BindingFlags -&gt; System.Reflection.MemberInfo []
member GetMember : string * System.Reflection.MemberTypes * System.Reflection.BindingFlags -&gt; System.Reflection.MemberInfo []
member GetMembers : unit -&gt; System.Reflection.MemberInfo []
member GetMembers : System.Reflection.BindingFlags -&gt; System.Reflection.MemberInfo []
member GetMethod : string -&gt; System.Reflection.MethodInfo
member GetMethod : string * System.Type [] -&gt; System.Reflection.MethodInfo
member GetMethod : string * System.Reflection.BindingFlags -&gt; System.Reflection.MethodInfo
member GetMethod : string * System.Type [] * System.Reflection.ParameterModifier [] -&gt; System.Reflection.MethodInfo
member GetMethod : string * System.Reflection.BindingFlags * System.Reflection.Binder * System.Type [] * System.Reflection.ParameterModifier [] -&gt; System.Reflection.MethodInfo
member GetMethod : string * System.Reflection.BindingFlags * System.Reflection.Binder * System.Reflection.CallingConventions * System.Type [] * System.Reflection.ParameterModifier [] -&gt; System.Reflection.MethodInfo
member GetMethods : unit -&gt; System.Reflection.MethodInfo []
member GetMethods : System.Reflection.BindingFlags -&gt; System.Reflection.MethodInfo []
member GetNestedType : string -&gt; System.Type
member GetNestedType : string * System.Reflection.BindingFlags -&gt; System.Type
member GetNestedTypes : unit -&gt; System.Type []
member GetNestedTypes : System.Reflection.BindingFlags -&gt; System.Type []
member GetProperties : unit -&gt; System.Reflection.PropertyInfo []
member GetProperties : System.Reflection.BindingFlags -&gt; System.Reflection.PropertyInfo []
member GetProperty : string -&gt; System.Reflection.PropertyInfo
member GetProperty : string * System.Reflection.BindingFlags -&gt; System.Reflection.PropertyInfo
member GetProperty : string * System.Type [] -&gt; System.Reflection.PropertyInfo
member GetProperty : string * System.Type -&gt; System.Reflection.PropertyInfo
member GetProperty : string * System.Type * System.Type [] -&gt; System.Reflection.PropertyInfo
member GetProperty : string * System.Type * System.Type [] * System.Reflection.ParameterModifier [] -&gt; System.Reflection.PropertyInfo
member GetProperty : string * System.Reflection.BindingFlags * System.Reflection.Binder * System.Type * System.Type [] * System.Reflection.ParameterModifier [] -&gt; System.Reflection.PropertyInfo
member GetType : unit -&gt; System.Type
member HasElementType : bool
member InvokeMember : string * System.Reflection.BindingFlags * System.Reflection.Binder * obj * obj [] -&gt; obj
member InvokeMember : string * System.Reflection.BindingFlags * System.Reflection.Binder * obj * obj [] * System.Globalization.CultureInfo -&gt; obj
member InvokeMember : string * System.Reflection.BindingFlags * System.Reflection.Binder * obj * obj [] * System.Reflection.ParameterModifier [] * System.Globalization.CultureInfo * string [] -&gt; obj
member IsAbstract : bool
member IsAnsiClass : bool
member IsArray : bool
member IsAssignableFrom : System.Type -&gt; bool
member IsAutoClass : bool
member IsAutoLayout : bool
member IsByRef : bool
member IsCOMObject : bool
member IsClass : bool
member IsContextful : bool
member IsEnum : bool
member IsEnumDefined : obj -&gt; bool
member IsEquivalentTo : System.Type -&gt; bool
member IsExplicitLayout : bool
member IsGenericParameter : bool
member IsGenericType : bool
member IsGenericTypeDefinition : bool
member IsImport : bool
member IsInstanceOfType : obj -&gt; bool
member IsInterface : bool
member IsLayoutSequential : bool
member IsMarshalByRef : bool
member IsNested : bool
member IsNestedAssembly : bool
member IsNestedFamANDAssem : bool
member IsNestedFamORAssem : bool
member IsNestedFamily : bool
member IsNestedPrivate : bool
member IsNestedPublic : bool
member IsNotPublic : bool
member IsPointer : bool
member IsPrimitive : bool
member IsPublic : bool
member IsSealed : bool
member IsSecurityCritical : bool
member IsSecuritySafeCritical : bool
member IsSecurityTransparent : bool
member IsSerializable : bool
member IsSpecialName : bool
member IsSubclassOf : System.Type -&gt; bool
member IsUnicodeClass : bool
member IsValueType : bool
member IsVisible : bool
member MakeArrayType : unit -&gt; System.Type
member MakeArrayType : int -&gt; System.Type
member MakeByRefType : unit -&gt; System.Type
member MakeGenericType : System.Type [] -&gt; System.Type
member MakePointerType : unit -&gt; System.Type
member MemberType : System.Reflection.MemberTypes
member Module : System.Reflection.Module
member Namespace : string
member ReflectedType : System.Type
member StructLayoutAttribute : System.Runtime.InteropServices.StructLayoutAttribute
member ToString : unit -&gt; string
member TypeHandle : System.RuntimeTypeHandle
member TypeInitializer : System.Reflection.ConstructorInfo
member UnderlyingSystemType : System.Type
static val FilterAttribute : System.Reflection.MemberFilter
static val FilterName : System.Reflection.MemberFilter
static val FilterNameIgnoreCase : System.Reflection.MemberFilter
static val Missing : obj
static val Delimiter : char
static val EmptyTypes : System.Type []
static member DefaultBinder : System.Reflection.Binder
static member GetType : string -&gt; System.Type
static member GetType : string * bool -&gt; System.Type
static member GetType : string * bool * bool -&gt; System.Type
static member GetType : string * System.Func&lt;System.Reflection.AssemblyName,System.Reflection.Assembly&gt; * System.Func&lt;System.Reflection.Assembly,string,bool,System.Type&gt; -&gt; System.Type
static member GetType : string * System.Func&lt;System.Reflection.AssemblyName,System.Reflection.Assembly&gt; * System.Func&lt;System.Reflection.Assembly,string,bool,System.Type&gt; * bool -&gt; System.Type
static member GetType : string * System.Func&lt;System.Reflection.AssemblyName,System.Reflection.Assembly&gt; * System.Func&lt;System.Reflection.Assembly,string,bool,System.Type&gt; * bool * bool -&gt; System.Type
static member GetTypeArray : obj [] -&gt; System.Type []
static member GetTypeCode : System.Type -&gt; System.TypeCode
static member GetTypeFromCLSID : System.Guid -&gt; System.Type
static member GetTypeFromCLSID : System.Guid * bool -&gt; System.Type
static member GetTypeFromCLSID : System.Guid * string -&gt; System.Type
static member GetTypeFromCLSID : System.Guid * string * bool -&gt; System.Type
static member GetTypeFromHandle : System.RuntimeTypeHandle -&gt; System.Type
static member GetTypeFromProgID : string -&gt; System.Type
static member GetTypeFromProgID : string * bool -&gt; System.Type
static member GetTypeFromProgID : string * string -&gt; System.Type
static member GetTypeFromProgID : string * string * bool -&gt; System.Type
static member GetTypeHandle : obj -&gt; System.RuntimeTypeHandle
static member ReflectionOnlyGetType : string * bool * bool -&gt; System.Type
end

Full name: System.Type

type: Type
implements: ICustomAttributeProvider
implements: Runtime.InteropServices._MemberInfo
implements: Runtime.InteropServices._Type
implements: IReflect
inherits: MemberInfo

</div>
<div id="fstips7" class="tip">union case Info.Fields: FieldInfo -&gt; Info</div>
<div id="fstips8" class="tip">

type FieldInfo =
class
inherit System.Reflection.MemberInfo
member Attributes : System.Reflection.FieldAttributes
member Equals : obj -&gt; bool
member FieldHandle : System.RuntimeFieldHandle
member FieldType : System.Type
member GetHashCode : unit -&gt; int
member GetOptionalCustomModifiers : unit -&gt; System.Type []
member GetRawConstantValue : unit -&gt; obj
member GetRequiredCustomModifiers : unit -&gt; System.Type []
member GetValue : obj -&gt; obj
member GetValueDirect : System.TypedReference -&gt; obj
member IsAssembly : bool
member IsFamily : bool
member IsFamilyAndAssembly : bool
member IsFamilyOrAssembly : bool
member IsInitOnly : bool
member IsLiteral : bool
member IsNotSerialized : bool
member IsPinvokeImpl : bool
member IsPrivate : bool
member IsPublic : bool
member IsSecurityCritical : bool
member IsSecuritySafeCritical : bool
member IsSecurityTransparent : bool
member IsSpecialName : bool
member IsStatic : bool
member MemberType : System.Reflection.MemberTypes
member SetValue : obj * obj -&gt; unit
member SetValue : obj * obj * System.Reflection.BindingFlags * System.Reflection.Binder * System.Globalization.CultureInfo -&gt; unit
member SetValueDirect : System.TypedReference * obj -&gt; unit
static member GetFieldFromHandle : System.RuntimeFieldHandle -&gt; System.Reflection.FieldInfo
static member GetFieldFromHandle : System.RuntimeFieldHandle * System.RuntimeTypeHandle -&gt; System.Reflection.FieldInfo
end

Full name: System.Reflection.FieldInfo

type: FieldInfo
implements: ICustomAttributeProvider
implements: Runtime.InteropServices._MemberInfo
implements: Runtime.InteropServices._FieldInfo
inherits: MemberInfo

</div>
<div id="fstips9" class="tip">union case Info.Properties: PropertyInfo -&gt; Info</div>
<div id="fstips10" class="tip">

type PropertyInfo =
class
inherit System.Reflection.MemberInfo
member Attributes : System.Reflection.PropertyAttributes
member CanRead : bool
member CanWrite : bool
member Equals : obj -&gt; bool
member GetAccessors : unit -&gt; System.Reflection.MethodInfo []
member GetAccessors : bool -&gt; System.Reflection.MethodInfo []
member GetConstantValue : unit -&gt; obj
member GetGetMethod : unit -&gt; System.Reflection.MethodInfo
member GetGetMethod : bool -&gt; System.Reflection.MethodInfo
member GetHashCode : unit -&gt; int
member GetIndexParameters : unit -&gt; System.Reflection.ParameterInfo []
member GetOptionalCustomModifiers : unit -&gt; System.Type []
member GetRawConstantValue : unit -&gt; obj
member GetRequiredCustomModifiers : unit -&gt; System.Type []
member GetSetMethod : unit -&gt; System.Reflection.MethodInfo
member GetSetMethod : bool -&gt; System.Reflection.MethodInfo
member GetValue : obj * obj [] -&gt; obj
member GetValue : obj * System.Reflection.BindingFlags * System.Reflection.Binder * obj [] * System.Globalization.CultureInfo -&gt; obj
member IsSpecialName : bool
member MemberType : System.Reflection.MemberTypes
member PropertyType : System.Type
member SetValue : obj * obj * obj [] -&gt; unit
member SetValue : obj * obj * System.Reflection.BindingFlags * System.Reflection.Binder * obj [] * System.Globalization.CultureInfo -&gt; unit
end

Full name: System.Reflection.PropertyInfo

type: PropertyInfo
implements: ICustomAttributeProvider
implements: Runtime.InteropServices._MemberInfo
implements: Runtime.InteropServices._PropertyInfo
inherits: MemberInfo

</div>
<div id="fstips11" class="tip">union case Info.Events: EventInfo -&gt; Info</div>
<div id="fstips12" class="tip">

type EventInfo =
class
inherit System.Reflection.MemberInfo
member AddEventHandler : obj * System.Delegate -&gt; unit
member Attributes : System.Reflection.EventAttributes
member Equals : obj -&gt; bool
member EventHandlerType : System.Type
member GetAddMethod : unit -&gt; System.Reflection.MethodInfo
member GetAddMethod : bool -&gt; System.Reflection.MethodInfo
member GetHashCode : unit -&gt; int
member GetOtherMethods : unit -&gt; System.Reflection.MethodInfo []
member GetOtherMethods : bool -&gt; System.Reflection.MethodInfo []
member GetRaiseMethod : unit -&gt; System.Reflection.MethodInfo
member GetRaiseMethod : bool -&gt; System.Reflection.MethodInfo
member GetRemoveMethod : unit -&gt; System.Reflection.MethodInfo
member GetRemoveMethod : bool -&gt; System.Reflection.MethodInfo
member IsMulticast : bool
member IsSpecialName : bool
member MemberType : System.Reflection.MemberTypes
member RemoveEventHandler : obj * System.Delegate -&gt; unit
end

Full name: System.Reflection.EventInfo

type: EventInfo
implements: ICustomAttributeProvider
implements: Runtime.InteropServices._MemberInfo
implements: Runtime.InteropServices._EventInfo
inherits: MemberInfo

</div>
<div id="fstips13" class="tip">union case Info.Methods: MethodInfo -&gt; Info</div>
<div id="fstips14" class="tip">

type MethodInfo =
class
inherit System.Reflection.MethodBase
member Equals : obj -&gt; bool
member GetBaseDefinition : unit -&gt; System.Reflection.MethodInfo
member GetGenericArguments : unit -&gt; System.Type []
member GetGenericMethodDefinition : unit -&gt; System.Reflection.MethodInfo
member GetHashCode : unit -&gt; int
member MakeGenericMethod : System.Type [] -&gt; System.Reflection.MethodInfo
member MemberType : System.Reflection.MemberTypes
member ReturnParameter : System.Reflection.ParameterInfo
member ReturnType : System.Type
member ReturnTypeCustomAttributes : System.Reflection.ICustomAttributeProvider
end

Full name: System.Reflection.MethodInfo

type: MethodInfo
implements: ICustomAttributeProvider
implements: Runtime.InteropServices._MemberInfo
implements: Runtime.InteropServices._MethodBase
implements: Runtime.InteropServices._MethodInfo
inherits: MethodBase
inherits: MemberInfo

</div>
<div id="fstips15" class="tip">union case Info.Constructors: ConstructorInfo -&gt; Info</div>
<div id="fstips16" class="tip">

type ConstructorInfo =
class
inherit System.Reflection.MethodBase
member Equals : obj -&gt; bool
member GetHashCode : unit -&gt; int
member Invoke : obj [] -&gt; obj
member Invoke : System.Reflection.BindingFlags * System.Reflection.Binder * obj [] * System.Globalization.CultureInfo -&gt; obj
member MemberType : System.Reflection.MemberTypes
static val ConstructorName : string
static val TypeConstructorName : string
end

Full name: System.Reflection.ConstructorInfo

type: ConstructorInfo
implements: ICustomAttributeProvider
implements: Runtime.InteropServices._MemberInfo
implements: Runtime.InteropServices._MethodBase
implements: Runtime.InteropServices._ConstructorInfo
inherits: MethodBase
inherits: MemberInfo

</div>
<div id="fstips17" class="tip">

val getTypes : string -&gt; seq&lt;Info&gt;

Full name: Arrow-Notation-via-FSharp.Reflect.getTypes

</div>
<div id="fstips18" class="tip">

val x : string

type: string
implements: IComparable
implements: ICloneable
implements: IConvertible
implements: IComparable&lt;string&gt;
implements: seq&lt;char&gt;
implements: Collections.IEnumerable
implements: IEquatable&lt;string&gt;

</div>
<div id="fstips19" class="tip">Multiple items

val string : 'T -&gt; string&nbsp;

Full name: Microsoft.FSharp.Core.Operators.string

--------------------

type string = String

Full name: Microsoft.FSharp.Core.string

type: string
implements: IComparable
implements: ICloneable
implements: IConvertible
implements: IComparable&lt;string&gt;
implements: seq&lt;char&gt;
implements: Collections.IEnumerable
implements: IEquatable&lt;string&gt;

</div>
<div id="fstips20" class="tip">

val asm : Assembly

type: Assembly
implements: Runtime.InteropServices._Assembly
implements: Security.IEvidenceFactory
implements: ICustomAttributeProvider
implements: Runtime.Serialization.ISerializable

</div>
<div id="fstips21" class="tip">

type Assembly =
class
member CodeBase : string
member CreateInstance : string -&gt; obj
member CreateInstance : string * bool -&gt; obj
member CreateInstance : string * bool * System.Reflection.BindingFlags * System.Reflection.Binder * obj [] * System.Globalization.CultureInfo * obj [] -&gt; obj
member EntryPoint : System.Reflection.MethodInfo
member Equals : obj -&gt; bool
member EscapedCodeBase : string
member Evidence : System.Security.Policy.Evidence
member FullName : string
member GetCustomAttributes : bool -&gt; obj []
member GetCustomAttributes : System.Type * bool -&gt; obj []
member GetCustomAttributesData : unit -&gt; System.Collections.Generic.IList&lt;System.Reflection.CustomAttributeData&gt;
member GetExportedTypes : unit -&gt; System.Type []
member GetFile : string -&gt; System.IO.FileStream
member GetFiles : unit -&gt; System.IO.FileStream []
member GetFiles : bool -&gt; System.IO.FileStream []
member GetHashCode : unit -&gt; int
member GetLoadedModules : unit -&gt; System.Reflection.Module []
member GetLoadedModules : bool -&gt; System.Reflection.Module []
member GetManifestResourceInfo : string -&gt; System.Reflection.ManifestResourceInfo
member GetManifestResourceNames : unit -&gt; string []
member GetManifestResourceStream : string -&gt; System.IO.Stream
member GetManifestResourceStream : System.Type * string -&gt; System.IO.Stream
member GetModule : string -&gt; System.Reflection.Module
member GetModules : unit -&gt; System.Reflection.Module []
member GetModules : bool -&gt; System.Reflection.Module []
member GetName : unit -&gt; System.Reflection.AssemblyName
member GetName : bool -&gt; System.Reflection.AssemblyName
member GetObjectData : System.Runtime.Serialization.SerializationInfo * System.Runtime.Serialization.StreamingContext -&gt; unit
member GetReferencedAssemblies : unit -&gt; System.Reflection.AssemblyName []
member GetSatelliteAssembly : System.Globalization.CultureInfo -&gt; System.Reflection.Assembly
member GetSatelliteAssembly : System.Globalization.CultureInfo * System.Version -&gt; System.Reflection.Assembly
member GetType : string -&gt; System.Type
member GetType : string * bool -&gt; System.Type
member GetType : string * bool * bool -&gt; System.Type
member GetTypes : unit -&gt; System.Type []
member GlobalAssemblyCache : bool
member HostContext : int64
member ImageRuntimeVersion : string
member IsDefined : System.Type * bool -&gt; bool
member IsDynamic : bool
member IsFullyTrusted : bool
member LoadModule : string * System.Byte [] -&gt; System.Reflection.Module
member LoadModule : string * System.Byte [] * System.Byte [] -&gt; System.Reflection.Module
member Location : string
member ManifestModule : System.Reflection.Module
member PermissionSet : System.Security.PermissionSet
member ReflectionOnly : bool
member SecurityRuleSet : System.Security.SecurityRuleSet
member ToString : unit -&gt; string
static member CreateQualifiedName : string * string -&gt; string
static member GetAssembly : System.Type -&gt; System.Reflection.Assembly
static member GetCallingAssembly : unit -&gt; System.Reflection.Assembly
static member GetEntryAssembly : unit -&gt; System.Reflection.Assembly
static member GetExecutingAssembly : unit -&gt; System.Reflection.Assembly
static member Load : string -&gt; System.Reflection.Assembly
static member Load : System.Reflection.AssemblyName -&gt; System.Reflection.Assembly
static member Load : System.Byte [] -&gt; System.Reflection.Assembly
static member Load : string * System.Security.Policy.Evidence -&gt; System.Reflection.Assembly
static member Load : System.Reflection.AssemblyName * System.Security.Policy.Evidence -&gt; System.Reflection.Assembly
static member Load : System.Byte [] * System.Byte [] -&gt; System.Reflection.Assembly
static member Load : System.Byte [] * System.Byte [] * System.Security.SecurityContextSource -&gt; System.Reflection.Assembly
static member Load : System.Byte [] * System.Byte [] * System.Security.Policy.Evidence -&gt; System.Reflection.Assembly
static member LoadFile : string -&gt; System.Reflection.Assembly
static member LoadFile : string * System.Security.Policy.Evidence -&gt; System.Reflection.Assembly
static member LoadFrom : string -&gt; System.Reflection.Assembly
static member LoadFrom : string * System.Security.Policy.Evidence -&gt; System.Reflection.Assembly
static member LoadFrom : string * System.Byte [] * System.Configuration.Assemblies.AssemblyHashAlgorithm -&gt; System.Reflection.Assembly
static member LoadFrom : string * System.Security.Policy.Evidence * System.Byte [] * System.Configuration.Assemblies.AssemblyHashAlgorithm -&gt; System.Reflection.Assembly
static member LoadWithPartialName : string -&gt; System.Reflection.Assembly
static member LoadWithPartialName : string * System.Security.Policy.Evidence -&gt; System.Reflection.Assembly
static member ReflectionOnlyLoad : string -&gt; System.Reflection.Assembly
static member ReflectionOnlyLoad : System.Byte [] -&gt; System.Reflection.Assembly
static member ReflectionOnlyLoadFrom : string -&gt; System.Reflection.Assembly
static member UnsafeLoadFrom : string -&gt; System.Reflection.Assembly
end

Full name: System.Reflection.Assembly

type: Assembly
implements: Runtime.InteropServices._Assembly
implements: Security.IEvidenceFactory
implements: ICustomAttributeProvider
implements: Runtime.Serialization.ISerializable

</div>
<div id="fstips22" class="tip">Multiple overloads

Assembly.LoadFrom(assemblyFile: string) : Assembly

Assembly.LoadFrom(assemblyFile: string, hashValue: byte [], hashAlgorithm: Configuration.Assemblies.AssemblyHashAlgorithm) : Assembly</div>
<div id="fstips23" class="tip">Assembly.GetTypes() : Type []</div>
<div id="fstips24" class="tip">

module Seq

from Microsoft.FSharp.Collections

</div>
<div id="fstips25" class="tip">

val map : ('T -&gt; 'U) -&gt; seq&lt;'T&gt; -&gt; seq&lt;'U&gt;

Full name: Microsoft.FSharp.Collections.Seq.map

</div>
<div id="fstips26" class="tip">

val x : Type

type: Type
implements: ICustomAttributeProvider
implements: Runtime.InteropServices._MemberInfo
implements: Runtime.InteropServices._Type
implements: IReflect
inherits: MemberInfo

</div>
<div id="fstips27" class="tip">

val getType : obj -&gt; Type

Full name: Arrow-Notation-via-FSharp.Reflect.getType

</div>
<div id="fstips28" class="tip">val x : obj</div>
<div id="fstips29" class="tip">

type obj = Object

Full name: Microsoft.FSharp.Core.obj

</div>
<div id="fstips30" class="tip">

val y : Type

type: Type
implements: ICustomAttributeProvider
implements: Runtime.InteropServices._MemberInfo
implements: Runtime.InteropServices._Type
implements: IReflect
inherits: MemberInfo

</div>
<div id="fstips31" class="tip">Object.GetType() : Type</div>
<div id="fstips32" class="tip">

val getFields : obj -&gt; BindingFlags -&gt; seq&lt;Info&gt;

Full name: Arrow-Notation-via-FSharp.Reflect.getFields

</div>
<div id="fstips33" class="tip">

val flags : BindingFlags

type: BindingFlags
inherits: Enum
inherits: ValueType

</div>
<div id="fstips34" class="tip">

type BindingFlags =
| Default = 0
| IgnoreCase = 1
| DeclaredOnly = 2
| Instance = 4
| Static = 8
| Public = 16
| NonPublic = 32
| FlattenHierarchy = 64
| InvokeMethod = 256
| CreateInstance = 512
| GetField = 1024
| SetField = 2048
| GetProperty = 4096
| SetProperty = 8192
| PutDispProperty = 16384
| PutRefDispProperty = 32768
| ExactBinding = 65536
| SuppressChangeType = 131072
| OptionalParamBinding = 262144
| IgnoreReturn = 16777216

Full name: System.Reflection.BindingFlags

type: BindingFlags
inherits: Enum
inherits: ValueType

</div>
<div id="fstips35" class="tip">

val t : Type

type: Type
implements: ICustomAttributeProvider
implements: Runtime.InteropServices._MemberInfo
implements: Runtime.InteropServices._Type
implements: IReflect
inherits: MemberInfo

</div>
<div id="fstips36" class="tip">Multiple overloads

Type.GetFields() : FieldInfo []

Type.GetFields(bindingAttr: BindingFlags) : FieldInfo []</div>
<div id="fstips37" class="tip">

val x : FieldInfo

type: FieldInfo
implements: ICustomAttributeProvider
implements: Runtime.InteropServices._MemberInfo
implements: Runtime.InteropServices._FieldInfo
inherits: MemberInfo

</div>
<div id="fstips38" class="tip">

val getProperties : obj -&gt; BindingFlags -&gt; seq&lt;Info&gt;

Full name: Arrow-Notation-via-FSharp.Reflect.getProperties

</div>
<div id="fstips39" class="tip">Multiple overloads

Type.GetProperties() : PropertyInfo []

Type.GetProperties(bindingAttr: BindingFlags) : PropertyInfo []</div>
<div id="fstips40" class="tip">

val x : PropertyInfo

type: PropertyInfo
implements: ICustomAttributeProvider
implements: Runtime.InteropServices._MemberInfo
implements: Runtime.InteropServices._PropertyInfo
inherits: MemberInfo

</div>
<div id="fstips41" class="tip">

val getEvents : obj -&gt; BindingFlags -&gt; seq&lt;Info&gt;

Full name: Arrow-Notation-via-FSharp.Reflect.getEvents

</div>
<div id="fstips42" class="tip">Multiple overloads

Type.GetEvents() : EventInfo []

Type.GetEvents(bindingAttr: BindingFlags) : EventInfo []</div>
<div id="fstips43" class="tip">

val x : EventInfo

type: EventInfo
implements: ICustomAttributeProvider
implements: Runtime.InteropServices._MemberInfo
implements: Runtime.InteropServices._EventInfo
inherits: MemberInfo

</div>
<div id="fstips44" class="tip">

val getMethods : obj -&gt; BindingFlags -&gt; seq&lt;Info&gt;

Full name: Arrow-Notation-via-FSharp.Reflect.getMethods

</div>
<div id="fstips45" class="tip">Multiple overloads

Type.GetMethods() : MethodInfo []

Type.GetMethods(bindingAttr: BindingFlags) : MethodInfo []</div>
<div id="fstips46" class="tip">

val x : MethodInfo

type: MethodInfo
implements: ICustomAttributeProvider
implements: Runtime.InteropServices._MemberInfo
implements: Runtime.InteropServices._MethodBase
implements: Runtime.InteropServices._MethodInfo
inherits: MethodBase
inherits: MemberInfo

</div>
<div id="fstips47" class="tip">

val getConstructors : obj -&gt; BindingFlags -&gt; seq&lt;Info&gt;

Full name: Arrow-Notation-via-FSharp.Reflect.getConstructors

</div>
<div id="fstips48" class="tip">Multiple overloads

Type.GetConstructors() : ConstructorInfo []

Type.GetConstructors(bindingAttr: BindingFlags) : ConstructorInfo []</div>
<div id="fstips49" class="tip">

val x : ConstructorInfo

type: ConstructorInfo
implements: ICustomAttributeProvider
implements: Runtime.InteropServices._MemberInfo
implements: Runtime.InteropServices._MethodBase
implements: Runtime.InteropServices._ConstructorInfo
inherits: MethodBase
inherits: MemberInfo

</div>
<div id="fstips50" class="tip">

val getMembers : BindingFlags -&gt; BindingFlags -&gt; BindingFlags -&gt; BindingFlags -&gt; BindingFlags -&gt; obj -&gt; seq&lt;Info&gt;

Full name: Arrow-Notation-via-FSharp.Reflect.getMembers

</div>
<div id="fstips51" class="tip">

val fflags : BindingFlags

type: BindingFlags
inherits: Enum
inherits: ValueType

</div>
<div id="fstips52" class="tip">

val pflags : BindingFlags

type: BindingFlags
inherits: Enum
inherits: ValueType

</div>
<div id="fstips53" class="tip">

val eflags : BindingFlags

type: BindingFlags
inherits: Enum
inherits: ValueType

</div>
<div id="fstips54" class="tip">

val mflags : BindingFlags

type: BindingFlags
inherits: Enum
inherits: ValueType

</div>
<div id="fstips55" class="tip">

val cflags : BindingFlags

type: BindingFlags
inherits: Enum
inherits: ValueType

</div>
<div id="fstips56" class="tip">Multiple items

val seq : seq&lt;'T&gt; -&gt; seq&lt;'T&gt;&nbsp;

Full name: Microsoft.FSharp.Core.Operators.seq

--------------------

type seq&lt;'T&gt; = Collections.Generic.IEnumerable&lt;'T&gt;

Full name: Microsoft.FSharp.Collections.seq&lt;_&gt;

type: seq&lt;'T&gt;
inherits: Collections.IEnumerable

</div>
<div id="fstips57" class="tip">

val Static : BindingFlags

Full name: Arrow-Notation-via-FSharp.Static

type: BindingFlags
inherits: Enum
inherits: ValueType

</div>
<div id="fstips58" class="tip">field BindingFlags.Static = 8</div>
<div id="fstips59" class="tip">field BindingFlags.NonPublic = 32</div>
<div id="fstips60" class="tip">field BindingFlags.Public = 16</div>
<div id="fstips61" class="tip">

val Instance : BindingFlags

Full name: Arrow-Notation-via-FSharp.Instance

type: BindingFlags
inherits: Enum
inherits: ValueType

</div>
<div id="fstips62" class="tip">field BindingFlags.Instance = 4</div>
<div id="fstips63" class="tip">

val All : BindingFlags

Full name: Arrow-Notation-via-FSharp.All

type: BindingFlags
inherits: Enum
inherits: ValueType

</div>
<div id="fstips64" class="tip">

val fscore : seq&lt;Reflect.Info&gt;

Full name: Arrow-Notation-via-FSharp.fscore

type: seq&lt;Reflect.Info&gt;
inherits: Collections.IEnumerable

</div>
<div id="fstips65" class="tip">

module Reflect

from Arrow-Notation-via-FSharp

</div>
<div id="fstips66" class="tip">

val getTypes : string -&gt; seq&lt;Reflect.Info&gt;

Full name: Arrow-Notation-via-FSharp.Reflect.getTypes

</div>
<div id="fstips67" class="tip">

val x : Reflect.Info

type: Reflect.Info
implements: IEquatable&lt;Reflect.Info&gt;
implements: Collections.IStructuralEquatable

</div>
<div id="fstips68" class="tip">union case Reflect.Info.Types: Type -&gt; Reflect.Info</div>
<div id="fstips69" class="tip">

val getMembers : BindingFlags -&gt; BindingFlags -&gt; BindingFlags -&gt; BindingFlags -&gt; BindingFlags -&gt; obj -&gt; seq&lt;Reflect.Info&gt;

Full name: Arrow-Notation-via-FSharp.Reflect.getMembers

</div>
<div id="fstips70" class="tip">property MemberInfo.Name: string</div>
<div id="fstips71" class="tip">

val failwith : string -&gt; 'T

Full name: Microsoft.FSharp.Core.Operators.failwith

</div>
<div id="fstips72" class="tip">

val iter : ('T -&gt; unit) -&gt; seq&lt;'T&gt; -&gt; unit

Full name: Microsoft.FSharp.Collections.Seq.iter

</div>
<div id="fstips73" class="tip">

val x : seq&lt;Reflect.Info&gt;

type: seq&lt;Reflect.Info&gt;
inherits: Collections.IEnumerable

</div>
<div id="fstips74" class="tip">

val y : string

type: string
implements: IComparable
implements: ICloneable
implements: IConvertible
implements: IComparable&lt;string&gt;
implements: seq&lt;char&gt;
implements: Collections.IEnumerable
implements: IEquatable&lt;string&gt;

</div>
<div id="fstips75" class="tip">

val printfn : Printf.TextWriterFormat&lt;'T&gt; -&gt; 'T

Full name: Microsoft.FSharp.Core.ExtraTopLevelOperators.printfn

</div>
<div id="fstips76" class="tip">union case Reflect.Info.Fields: FieldInfo -&gt; Reflect.Info</div>
<div id="fstips77" class="tip">union case Reflect.Info.Properties: PropertyInfo -&gt; Reflect.Info</div>
<div id="fstips78" class="tip">union case Reflect.Info.Events: EventInfo -&gt; Reflect.Info</div>
<div id="fstips79" class="tip">union case Reflect.Info.Methods: MethodInfo -&gt; Reflect.Info</div>
<div id="fstips80" class="tip">union case Reflect.Info.Constructors: ConstructorInfo -&gt; Reflect.Info</div>
<div id="fstips81" class="tip">

val sum : int -&gt; int -&gt; int

Full name: Arrow-Notation-via-FSharp.sum

</div>
<div id="fstips82" class="tip">

val a : int

type: int
implements: IComparable
implements: IFormattable
implements: IConvertible
implements: IComparable&lt;int&gt;
implements: IEquatable&lt;int&gt;
inherits: ValueType

</div>
<div id="fstips83" class="tip">

val b : int

type: int
implements: IComparable
implements: IFormattable
implements: IConvertible
implements: IComparable&lt;int&gt;
implements: IEquatable&lt;int&gt;
inherits: ValueType

</div>
<div id="fstips84" class="tip">

val mul : int -&gt; int -&gt; int

Full name: Arrow-Notation-via-FSharp.mul

</div>
<div id="fstips85" class="tip">

val sqr : int -&gt; int

Full name: Arrow-Notation-via-FSharp.sqr

</div>
<div id="fstips86" class="tip">

val n : int

type: int
implements: IComparable
implements: IFormattable
implements: IConvertible
implements: IComparable&lt;int&gt;
implements: IEquatable&lt;int&gt;
inherits: ValueType

</div>
<div id="fstips87" class="tip">

val drakeEq : int -&gt; float -&gt; float -&gt; float -&gt; float -&gt; float -&gt; int -&gt; float

Full name: Arrow-Notation-via-FSharp.drakeEq

</div>
<div id="fstips88" class="tip">Multiple items

val R : int&nbsp;

type: int
implements: IComparable
implements: IFormattable
implements: IConvertible
implements: IComparable&lt;int&gt;
implements: IEquatable&lt;int&gt;
inherits: ValueType

--------------------

val R : int

type: int
implements: IComparable
implements: IFormattable
implements: IConvertible
implements: IComparable&lt;int&gt;
implements: IEquatable&lt;int&gt;
inherits: ValueType

</div>
<div id="fstips89" class="tip">

val fp : float

type: float
implements: IComparable
implements: IFormattable
implements: IConvertible
implements: IComparable&lt;float&gt;
implements: IEquatable&lt;float&gt;
inherits: ValueType

</div>
<div id="fstips90" class="tip">

val ne : float

type: float
implements: IComparable
implements: IFormattable
implements: IConvertible
implements: IComparable&lt;float&gt;
implements: IEquatable&lt;float&gt;
inherits: ValueType

</div>
<div id="fstips91" class="tip">

val fl : float

type: float
implements: IComparable
implements: IFormattable
implements: IConvertible
implements: IComparable&lt;float&gt;
implements: IEquatable&lt;float&gt;
inherits: ValueType

</div>
<div id="fstips92" class="tip">

val fi : float

type: float
implements: IComparable
implements: IFormattable
implements: IConvertible
implements: IComparable&lt;float&gt;
implements: IEquatable&lt;float&gt;
inherits: ValueType

</div>
<div id="fstips93" class="tip">

val fc : float

type: float
implements: IComparable
implements: IFormattable
implements: IConvertible
implements: IComparable&lt;float&gt;
implements: IEquatable&lt;float&gt;
inherits: ValueType

</div>
<div id="fstips94" class="tip">Multiple items

val L : int&nbsp;

type: int
implements: IComparable
implements: IFormattable
implements: IConvertible
implements: IComparable&lt;int&gt;
implements: IEquatable&lt;int&gt;
inherits: ValueType

--------------------

val L : int

type: int
implements: IComparable
implements: IFormattable
implements: IConvertible
implements: IComparable&lt;int&gt;
implements: IEquatable&lt;int&gt;
inherits: ValueType

</div>
<div id="fstips95" class="tip">Multiple items

val float : 'T -&gt; float (requires member op_Explicit)&nbsp;

Full name: Microsoft.FSharp.Core.Operators.float

--------------------

type float&lt;'Measure&gt; = float

Full name: Microsoft.FSharp.Core.float&lt;_&gt;

type: float&lt;'Measure&gt;
implements: IComparable
implements: IConvertible
implements: IFormattable
implements: IComparable&lt;float&lt;'Measure&gt;&gt;
implements: IEquatable&lt;float&lt;'Measure&gt;&gt;
inherits: ValueType

--------------------

type float = Double

Full name: Microsoft.FSharp.Core.float

type: float
implements: IComparable
implements: IFormattable
implements: IConvertible
implements: IComparable&lt;float&gt;
implements: IEquatable&lt;float&gt;
inherits: ValueType

</div>
<div id="fstips96" class="tip">

val R : int

type: int
implements: IComparable
implements: IFormattable
implements: IConvertible
implements: IComparable&lt;int&gt;
implements: IEquatable&lt;int&gt;
inherits: ValueType

</div>
<div id="fstips97" class="tip">

val L : int

type: int
implements: IComparable
implements: IFormattable
implements: IConvertible
implements: IComparable&lt;int&gt;
implements: IEquatable&lt;int&gt;
inherits: ValueType

</div>
<div id="fstips98" class="tip">Multiple items

val int : 'T -&gt; int (requires member op_Explicit)&nbsp;

Full name: Microsoft.FSharp.Core.Operators.int

--------------------

type int&lt;'Measure&gt; = int

Full name: Microsoft.FSharp.Core.int&lt;_&gt;

type: int&lt;'Measure&gt;
implements: IComparable
implements: IConvertible
implements: IFormattable
implements: IComparable&lt;int&lt;'Measure&gt;&gt;
implements: IEquatable&lt;int&lt;'Measure&gt;&gt;
inherits: ValueType

--------------------

type int = int32

Full name: Microsoft.FSharp.Core.int

type: int
implements: IComparable
implements: IFormattable
implements: IConvertible
implements: IComparable&lt;int&gt;
implements: IEquatable&lt;int&gt;
inherits: ValueType

</div>
<div id="fstips99" class="tip">

type 'a LinkedList =
| Empty
| Element of 'a * 'a LinkedList

Full name: Arrow-Notation-via-FSharp.LinkedList&lt;_&gt;

type: 'a LinkedList
implements: IEquatable&lt;'a LinkedList&gt;
implements: Collections.IStructuralEquatable
implements: IComparable&lt;'a LinkedList&gt;
implements: IComparable
implements: Collections.IStructuralComparable

</div>
<div id="fstips100" class="tip">union case LinkedList.Empty: 'a LinkedList</div>
<div id="fstips101" class="tip">union case LinkedList.Element: 'a * 'a LinkedList -&gt; 'a LinkedList</div>
<div id="fstips102" class="tip">

val drakeEq' : int * float * float * float * float * float * int -&gt; float

Full name: Arrow-Notation-via-FSharp.drakeEq'

</div>
<div id="fstips103" class="tip">

val xs : int LinkedList

Full name: Arrow-Notation-via-FSharp.xs

type: int LinkedList
implements: IEquatable&lt;int LinkedList&gt;
implements: Collections.IStructuralEquatable
implements: IComparable&lt;int LinkedList&gt;
implements: IComparable
implements: Collections.IStructuralComparable

</div>
<div id="fstips104" class="tip">

val filter : ('T -&gt; bool) -&gt; seq&lt;'T&gt; -&gt; seq&lt;'T&gt;

Full name: Microsoft.FSharp.Collections.Seq.filter

</div>
<div id="fstips105" class="tip">

val x : int

type: int
implements: IComparable
implements: IFormattable
implements: IConvertible
implements: IComparable&lt;int&gt;
implements: IEquatable&lt;int&gt;
inherits: ValueType

</div>
<div id="fstips106" class="tip">

val next : (int -&gt; int)

Full name: Arrow-Notation-via-FSharp.next

</div>
<div id="fstips107" class="tip">

val twice : (int -&gt; int)

Full name: Arrow-Notation-via-FSharp.twice

</div>
<div id="fstips108" class="tip">

val x : int

Full name: Arrow-Notation-via-FSharp.x

type: int
implements: IComparable
implements: IFormattable
implements: IConvertible
implements: IComparable&lt;int&gt;
implements: IEquatable&lt;int&gt;
inherits: ValueType

</div>
<div id="fstips109" class="tip">

val foldr : ('a -&gt; 'b -&gt; 'b) -&gt; 'b -&gt; 'a LinkedList -&gt; 'b

Full name: Arrow-Notation-via-FSharp.foldr

</div>
<div id="fstips110" class="tip">val f : ('a -&gt; 'b -&gt; 'b)</div>
<div id="fstips111" class="tip">val acc : 'b</div>
<div id="fstips112" class="tip">

val xs : 'a LinkedList

type: 'a LinkedList
implements: IEquatable&lt;'a LinkedList&gt;
implements: Collections.IStructuralEquatable
implements: IComparable&lt;'a LinkedList&gt;
implements: IComparable
implements: Collections.IStructuralComparable

</div>
<div id="fstips113" class="tip">val foldr : ('a LinkedList -&gt; ('b -&gt; 'c) -&gt; 'c)</div>
<div id="fstips114" class="tip">val k : ('b -&gt; 'c)</div>
<div id="fstips115" class="tip">val x : 'a</div>
<div id="fstips116" class="tip">val racc : 'b</div>
<div id="fstips117" class="tip">

val id : 'T -&gt; 'T

Full name: Microsoft.FSharp.Core.Operators.id

</div>
<div id="fstips118" class="tip">

val foldl : ('a -&gt; 'b -&gt; 'a) -&gt; 'a -&gt; 'b LinkedList -&gt; 'a

Full name: Arrow-Notation-via-FSharp.foldl

</div>
<div id="fstips119" class="tip">val f : ('a -&gt; 'b -&gt; 'a)</div>
<div id="fstips120" class="tip">val acc : 'a</div>
<div id="fstips121" class="tip">

val xs : 'b LinkedList

type: 'b LinkedList
implements: IEquatable&lt;'b LinkedList&gt;
implements: Collections.IStructuralEquatable
implements: IComparable&lt;'b LinkedList&gt;
implements: IComparable
implements: Collections.IStructuralComparable

</div>
<div id="fstips122" class="tip">val x : 'b</div>
<div id="fstips123" class="tip">

val identity : 'a LinkedList -&gt; 'a LinkedList

Full name: Arrow-Notation-via-FSharp.identity

</div>
<div id="fstips124" class="tip">

val reverse : 'a LinkedList -&gt; 'a LinkedList

Full name: Arrow-Notation-via-FSharp.reverse

</div>
<div id="fstips125" class="tip">

val length : 'a LinkedList -&gt; int

Full name: Arrow-Notation-via-FSharp.length

</div>
<div id="fstips126" class="tip">

val xs : int

type: int
implements: IComparable
implements: IFormattable
implements: IConvertible
implements: IComparable&lt;int&gt;
implements: IEquatable&lt;int&gt;
inherits: ValueType

</div>
<div id="fstips127" class="tip">

val summation : int LinkedList -&gt; int

Full name: Arrow-Notation-via-FSharp.summation

</div>
<div id="fstips128" class="tip">

val xs : int LinkedList

type: int LinkedList
implements: IEquatable&lt;int LinkedList&gt;
implements: Collections.IStructuralEquatable
implements: IComparable&lt;int LinkedList&gt;
implements: IComparable
implements: Collections.IStructuralComparable

</div>
<div id="fstips129" class="tip">

val product : int LinkedList -&gt; int

Full name: Arrow-Notation-via-FSharp.product

</div>
<div id="fstips130" class="tip">

val unfold : ('a -&gt; 'b * 'a) -&gt; ('a -&gt; bool) -&gt; 'a -&gt; 'b LinkedList

Full name: Arrow-Notation-via-FSharp.unfold

</div>
<div id="fstips131" class="tip">val unspool : ('a -&gt; 'b * 'a)</div>
<div id="fstips132" class="tip">val finished : ('a -&gt; bool)</div>
<div id="fstips133" class="tip">val a : 'b</div>
<div id="fstips134" class="tip">val y : 'a</div>
<div id="fstips135" class="tip">

val fibUntil : int -&gt; int LinkedList

Full name: Arrow-Notation-via-FSharp.fibUntil

</div>
<div id="fstips136" class="tip">

val until : int

type: int
implements: IComparable
implements: IFormattable
implements: IConvertible
implements: IComparable&lt;int&gt;
implements: IEquatable&lt;int&gt;
inherits: ValueType

</div>
<div id="fstips137" class="tip">val x : int * int</div>
<div id="fstips138" class="tip">

val b' : int

type: int
implements: IComparable
implements: IFormattable
implements: IConvertible
implements: IComparable&lt;int&gt;
implements: IEquatable&lt;int&gt;
inherits: ValueType

</div>
<div id="fstips139" class="tip">

val fst : ('T1 * 'T2) -&gt; 'T1

Full name: Microsoft.FSharp.Core.Operators.fst

</div>
<div id="fstips140" class="tip">

val snd : ('T1 * 'T2) -&gt; 'T2

Full name: Microsoft.FSharp.Core.Operators.snd

</div>
<div id="fstips141" class="tip">

val fibs : int -&gt; int LinkedList

Full name: Arrow-Notation-via-FSharp.fibs

</div>
<div id="fstips142" class="tip">

val x : int ref

type: int ref
implements: Collections.IStructuralEquatable
implements: IComparable&lt;Ref&lt;int&gt;&gt;
implements: IComparable
implements: Collections.IStructuralComparable

</div>
<div id="fstips143" class="tip">Multiple items

val ref : 'T -&gt; 'T ref&nbsp;

Full name: Microsoft.FSharp.Core.Operators.ref

--------------------

type 'T ref = Ref&lt;'T&gt;

Full name: Microsoft.FSharp.Core.ref&lt;_&gt;

type: 'T ref
implements: Collections.IStructuralEquatable
implements: IComparable&lt;Ref&lt;'T&gt;&gt;
implements: IComparable
implements: Collections.IStructuralComparable

</div>
<div id="fstips144" class="tip">

val fibonacci : seq&lt;Numerics.BigInteger&gt;

Full name: Arrow-Notation-via-FSharp.fibonacci

type: seq&lt;Numerics.BigInteger&gt;
inherits: Collections.IEnumerable

</div>
<div id="fstips145" class="tip">

val unfold : ('State -&gt; ('T * 'State) option) -&gt; 'State -&gt; seq&lt;'T&gt;

Full name: Microsoft.FSharp.Collections.Seq.unfold

</div>
<div id="fstips146" class="tip">

val x : Numerics.BigInteger

type: Numerics.BigInteger
implements: IFormattable
implements: IComparable
implements: IComparable&lt;Numerics.BigInteger&gt;
implements: IEquatable&lt;Numerics.BigInteger&gt;
inherits: ValueType

</div>
<div id="fstips147" class="tip">

val y : Numerics.BigInteger

type: Numerics.BigInteger
implements: IFormattable
implements: IComparable
implements: IComparable&lt;Numerics.BigInteger&gt;
implements: IEquatable&lt;Numerics.BigInteger&gt;
inherits: ValueType

</div>
<div id="fstips148" class="tip">union case Option.Some: 'T -&gt; Option&lt;'T&gt;</div>
<div id="fstips149" class="tip">

val nth : int -&gt; seq&lt;'T&gt; -&gt; 'T

Full name: Microsoft.FSharp.Collections.Seq.nth

</div>
<div id="fstips150" class="tip">namespace Microsoft</div>
<div id="fstips151" class="tip">module SfsWrapper</div>
<div id="fstips152" class="tip">

type MeasureAttribute =
class
inherit Attribute
new : unit -&gt; MeasureAttribute
end

Full name: Microsoft.FSharp.Core.MeasureAttribute

type: MeasureAttribute
implements: Runtime.InteropServices._Attribute
inherits: Attribute

</div>
<div id="fstips153" class="tip">

[&lt;Measure&gt;]
type Year

Full name: Arrow-Notation-via-FSharp.Year

</div>
<div id="fstips154" class="tip">

[&lt;Measure&gt;]
type Star

Full name: Arrow-Notation-via-FSharp.Star

</div>
<div id="fstips155" class="tip">

[&lt;Measure&gt;]
type Planet

Full name: Arrow-Notation-via-FSharp.Planet

</div>
<div id="fstips156" class="tip">

[&lt;Measure&gt;]
type LifeCapible =/Star

Full name: Arrow-Notation-via-FSharp.LifeCapible

</div>
<div id="fstips157" class="tip">

[&lt;Measure&gt;]
type Life = Planet/LifeCapible

Full name: Arrow-Notation-via-FSharp.Life

</div>
<div id="fstips158" class="tip">

[&lt;Measure&gt;]
type IntelligentLife = Planet/Life

Full name: Arrow-Notation-via-FSharp.IntelligentLife

</div>
<div id="fstips159" class="tip">

[&lt;Measure&gt;]
type CommunicatingIntelligentLife = Planet/IntelligentLife

Full name: Arrow-Notation-via-FSharp.CommunicatingIntelligentLife

</div>
<div id="fstips160" class="tip">

[&lt;Measure&gt;]
type Civilization

Full name: Arrow-Notation-via-FSharp.Civilization

</div>
<div id="fstips161" class="tip">

val context : 'a

Full name: Arrow-Notation-via-FSharp.context

</div>
<div id="fstips162" class="tip">

val drake : SfsModel

Full name: Arrow-Notation-via-FSharp.drake

</div>
<div id="fstips163" class="tip">

type SfsModel =
class
new : context:'a -&gt; SfsModel
member Abs : x:SfsRealTerm&lt;'u&gt; -&gt; 'a
member Abs : x:SfsIntTerm&lt;'u&gt; -&gt; 'a
member AddConstraint : term:'_arg96 -&gt; 'a
member AddConstraint : name:'a * term:'b -&gt; 'c
member AddConstraints : terms:'_arg72 [] -&gt; 'a
member AddConstraints : name:'a * terms:'b -&gt; 'c
member AddGoal : goalKind:'a * objective:SfsIntTerm&lt;'u&gt; -&gt; 'b
member AddGoal : goalKind:'a * objective:SfsRealTerm&lt;'u&gt; -&gt; 'b
member AddGoal : name:'a * goalKind:'b * objective:SfsIntTerm&lt;'u&gt; -&gt; 'c
member AddGoal : name:'a * goalKind:'b * objective:SfsRealTerm&lt;'u&gt; -&gt; 'c
member AllDifferent : args:SfsRealTerm&lt;'u&gt; [] -&gt; 'a
member AllDifferent : args:SfsIntTerm&lt;'u&gt; [] -&gt; 'a
member AllDifferent : args:SfsSymbolicVariable&lt;'b&gt; [] -&gt; 'a
member And : args:SfsBooleanTerm [] -&gt; 'a
member AtMostMofN : m:'a * args:SfsBooleanTerm array -&gt; 'b
member CreateBooleanVariable : unit -&gt; 'a
member CreateBooleanVariable : name:'a -&gt; 'b
member CreateIntConstant : x:int&lt;'u&gt; -&gt; SfsIntTerm&lt;'u&gt;
member CreateIntNonnegativeVariable : unit -&gt; 'a
member CreateIntNonnegativeVariable : name:'a -&gt; 'b
member CreateIntRangeVariable : min:'a * max:'b -&gt; 'c
member CreateIntRangeVariable : min:int&lt;'u&gt; * max:int&lt;'u&gt; * name:'a -&gt; 'b
member CreateIntSetVariable : allowedValues:'a -&gt; 'b
member CreateIntSetVariable : allowedValues:Set&lt;int&lt;'u&gt;&gt; * name:'a -&gt; 'b
member CreateIntVariable : unit -&gt; 'a
member CreateIntVariable : name:'a -&gt; 'b
member CreateRealConstant : x:float&lt;'u&gt; -&gt; SfsRealTerm&lt;'u&gt;
member CreateRealNonnegativeVariable : unit -&gt; 'a
member CreateRealNonnegativeVariable : name:'a -&gt; 'b
member CreateRealRangeVariable : min:'a * max:'b -&gt; 'c
member CreateRealRangeVariable : min:float&lt;'u&gt; * max:float&lt;'u&gt; * name:'a -&gt; 'b
member CreateRealSetVariable : allowedValues:'a -&gt; 'b
member CreateRealSetVariable : allowedValues:Set&lt;float&lt;'u&gt;&gt; -&gt; 'a
member CreateRealSetVariable : allowedValues:'a * name:'b -&gt; 'c
member CreateRealSetVariable : allowedValues:Set&lt;float&lt;'u&gt;&gt; * name:'a -&gt; 'b
member CreateRealVariable : unit -&gt; int
member CreateRealVariable : name:'a -&gt; 'b
member CreateSymbolicVariable : unit -&gt; 'a
member CreateSymbolicVariable : name:'a -&gt; 'b
member Difference : l:SfsRealTerm&lt;'u&gt; * r:SfsRealTerm&lt;'u&gt; -&gt; 'a
member Difference : l:SfsIntTerm&lt;'u 'w&gt; * r:SfsIntTerm&lt;'u 'w&gt; -&gt; 'a
member Equal : args:SfsRealTerm&lt;'u&gt; [] -&gt; 'a
member Equal : args:SfsIntTerm&lt;'u&gt; [] -&gt; 'a
member Equal : args:SfsSymbolicVariable&lt;'a&gt; [] -&gt; 'b
member ExactlyMofN : m:'a * args:SfsBooleanTerm array -&gt; 'b
member ForEach : args:'a array * f:('a -&gt; SfsBooleanTerm) -&gt; 'b
member ForEachWhere : args:'a array * predicate:('a -&gt; SfsBooleanTerm) * f:('a -&gt; SfsBooleanTerm) -&gt; 'b
member Greater : args:SfsRealTerm&lt;'u&gt; [] -&gt; 'a
member Greater : args:SfsIntTerm&lt;'u&gt; [] -&gt; 'a
member GreaterEqual : args:SfsRealTerm&lt;'u&gt; [] -&gt; 'a
member GreaterEqual : args:SfsIntTerm&lt;'u&gt; [] -&gt; 'a
member Less : args:SfsRealTerm&lt;'u&gt; [] -&gt; 'a
member Less : args:SfsIntTerm&lt;'u&gt; [] -&gt; 'a
member LessEqual : args:SfsRealTerm&lt;'u&gt; [] -&gt; 'a
member LessEqual : args:SfsIntTerm&lt;'u&gt; [] -&gt; 'a
member Negate : x:SfsRealTerm&lt;'u&gt; -&gt; 'a
member Negate : x:SfsIntTerm&lt;'u&gt; -&gt; 'a
member Not : arg:SfsBooleanTerm -&gt; 'a (requires 'a :&gt; SfsBooleanTerm)
member Or : args:SfsBooleanTerm [] -&gt; 'a
member internal Product : l:'a * r:'a -&gt; 'a
member RemoveConstraint : c:SfsConstraint -&gt; 'a
member RemoveGoal : g:'a -&gt; 'b (requires 'a :&gt; SfsGoal)
member SaveModel : format:'a * writer:'b -&gt; 'c
member Solve : directives:'a -&gt; 'b
member Solve : directive:'a -&gt; 'b
member Solve : x:'a -&gt; 'b
member Square : x:SfsRealTerm&lt;'u&gt; -&gt; 'a
member Square : x:SfsIntTerm&lt;'u&gt; -&gt; 'a
member Sum : args:SfsRealTerm&lt;'u&gt; array -&gt; 'a
member Sum : args:SfsIntTerm&lt;'u 'w&gt; array -&gt; 'a
member Sum : args:SfsRealVariable&lt;'u&gt; array -&gt; 'a
member Sum : args:SfsIntVariable&lt;'u&gt; array -&gt; 'a
member False : 'a
member Model : 'a
member True : 'a
end

Full name: SfsWrapper.SfsWrapper.SfsModel

<em>Describes a Solver Foundation model, i.e., a problem description with
variables, constraints, objectives, etc.</em>

</div>
<div id="fstips164" class="tip">

val R : int

Full name: Arrow-Notation-via-FSharp.R

type: int
implements: IComparable
implements: IFormattable
implements: IConvertible
implements: IComparable&lt;int&gt;
implements: IEquatable&lt;int&gt;
inherits: ValueType

</div>
<div id="fstips165" class="tip">Multiple overloads

member SfsModel.CreateRealVariable : unit -&gt; int&nbsp;

<em>Creates a real valued (float) decision variable with unit-of-measure, and
adds it to the model</em>

member SfsModel.CreateRealVariable : name:'a -&gt; 'b

<em>Creates a real valued (float) decision variable with unit-of-measure, and
adds it to the model</em>

</div>
<div id="fstips166" class="tip">

val fp : int

Full name: Arrow-Notation-via-FSharp.fp

type: int
implements: IComparable
implements: IFormattable
implements: IConvertible
implements: IComparable&lt;int&gt;
implements: IEquatable&lt;int&gt;
inherits: ValueType

</div>
<div id="fstips167" class="tip">

val ne : int

Full name: Arrow-Notation-via-FSharp.ne

type: int
implements: IComparable
implements: IFormattable
implements: IConvertible
implements: IComparable&lt;int&gt;
implements: IEquatable&lt;int&gt;
inherits: ValueType

</div>
<div id="fstips168" class="tip">

val fl : int

Full name: Arrow-Notation-via-FSharp.fl

type: int
implements: IComparable
implements: IFormattable
implements: IConvertible
implements: IComparable&lt;int&gt;
implements: IEquatable&lt;int&gt;
inherits: ValueType

</div>
<div id="fstips169" class="tip">

val fi : int

Full name: Arrow-Notation-via-FSharp.fi

type: int
implements: IComparable
implements: IFormattable
implements: IConvertible
implements: IComparable&lt;int&gt;
implements: IEquatable&lt;int&gt;
inherits: ValueType

</div>
<div id="fstips170" class="tip">

val fc : int

Full name: Arrow-Notation-via-FSharp.fc

type: int
implements: IComparable
implements: IFormattable
implements: IConvertible
implements: IComparable&lt;int&gt;
implements: IEquatable&lt;int&gt;
inherits: ValueType

</div>
<div id="fstips171" class="tip">

val L : int

Full name: Arrow-Notation-via-FSharp.L

type: int
implements: IComparable
implements: IFormattable
implements: IConvertible
implements: IComparable&lt;int&gt;
implements: IEquatable&lt;int&gt;
inherits: ValueType

</div>
<div id="fstips172" class="tip">

val N : int

Full name: Arrow-Notation-via-FSharp.N

type: int
implements: IComparable
implements: IFormattable
implements: IConvertible
implements: IComparable&lt;int&gt;
implements: IEquatable&lt;int&gt;
inherits: ValueType

</div>
<div id="fstips173" class="tip">Multiple overloads

member SfsModel.AddConstraints : terms:'_arg72 [] -&gt; 'a&nbsp;

<em>Adds a list of boolean terms as constraints</em>

member SfsModel.AddConstraints : name:'a * terms:'b -&gt; 'c

<em>Adds a list of boolean terms as constraints</em>

</div>
<div id="fstips174" class="tip">

val cR : 'a

Full name: Arrow-Notation-via-FSharp.cR

</div>
<div id="fstips175" class="tip">Multiple overloads

member SfsModel.AddConstraint : term:'_arg96 -&gt; 'a&nbsp;

<em>Adds a single boolean term as a constraint</em>

member SfsModel.AddConstraint : name:'a * term:'b -&gt; 'c

<em>Adds a single boolean term as a constraint</em>

</div>
<div id="fstips176" class="tip">

val cfp : 'a

Full name: Arrow-Notation-via-FSharp.cfp

</div>
<div id="fstips177" class="tip">

val cne : 'a

Full name: Arrow-Notation-via-FSharp.cne

</div>
<div id="fstips178" class="tip">

val cfl : 'a

Full name: Arrow-Notation-via-FSharp.cfl

</div>
<div id="fstips179" class="tip">

val cfi : 'a

Full name: Arrow-Notation-via-FSharp.cfi

</div>
<div id="fstips180" class="tip">

val cfc : 'a

Full name: Arrow-Notation-via-FSharp.cfc

</div>
<div id="fstips181" class="tip">

val cL : 'a

Full name: Arrow-Notation-via-FSharp.cL

</div>
<div id="fstips182" class="tip">

val cN : 'a

Full name: Arrow-Notation-via-FSharp.cN

</div>
<div id="fstips183" class="tip">

val minimumLifeCapible : 'a

Full name: Arrow-Notation-via-FSharp.minimumLifeCapible

</div>
<div id="fstips184" class="tip">Multiple overloads

member SfsModel.AddGoal : goalKind:'a * objective:SfsIntTerm&lt;'u&gt; -&gt; 'b&nbsp;

<em>Adds a numerical term as an objective function (goal)</em>

member SfsModel.AddGoal : goalKind:'a * objective:SfsRealTerm&lt;'u&gt; -&gt; 'b

<em>Adds a numerical term as an objective function (goal)</em>

member SfsModel.AddGoal : name:'a * goalKind:'b * objective:SfsIntTerm&lt;'u&gt; -&gt; 'c

<em>Adds a numerical term as an objective function (goal)</em>

member SfsModel.AddGoal : name:'a * goalKind:'b * objective:SfsRealTerm&lt;'u&gt; -&gt; 'c

<em>Adds a numerical term as an objective function (goal)</em>

</div>
<div id="fstips185" class="tip">

val solution : 'a

Full name: Arrow-Notation-via-FSharp.solution

</div>
<div id="fstips186" class="tip">Multiple overloads

member SfsModel.Solve : directives:'a -&gt; 'b&nbsp;

<em>Solves the program, with a given solver or a set of solvers in parallel.
Use this when solvers need to be parameterized</em>

member SfsModel.Solve : directive:'a -&gt; 'b

<em>Solves the program, with a given solver in its default configuration</em>

member SfsModel.Solve : x:'a -&gt; 'b

<em>Solves the program using a simplex solver</em>

</div>
<div id="fstips187" class="tip">union case SolverDirectives.LocalSearch: SolverDirectives</div>
</p>
<p/>
Solver Foundation is really fun to play with and the samples that come with it are great!  But I’ll save a post on it for later.  F# 3.0 will ship with a feature called “Type Providers” which will make it trivial to retrieve values for these variables from existing data sources in the cloud.</p>
 <img src="http://blog.thinkhard.net/wp-content/plugins/wordpress-feed-statistics/feed-statistics.php?view=1&post_id=53" width="1" height="1" style="display: none;" />]]></content:encoded>
			<wfw:commentRss>http://blog.thinkhard.net/2011/03/arrow-notation-via-f/feed/</wfw:commentRss>
		<slash:comments>24</slash:comments>
		</item>
	</channel>
</rss>

