<?xml version="1.0" encoding="UTF-8"?><rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	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/"
		>
<channel>
	<title>Comments on: &#8216;Embedding&#8217; F# in PowerShell</title>
	<atom:link href="http://www.dougfinke.com/blog/index.php/2007/07/27/embedding-f-in-powershell/feed/" rel="self" type="application/rss+xml" />
	<link>http://www.dougfinke.com/blog/index.php/2007/07/27/embedding-f-in-powershell/?utm_source=rss&amp;utm_medium=rss&amp;utm_campaign=embedding-f-in-powershell</link>
	<description>Researching the optimal; implementing the practical</description>
	<lastBuildDate>Tue, 07 Sep 2010 16:08:28 +0000</lastBuildDate>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.0.1</generator>
	<item>
		<title>By: Mr. Spock</title>
		<link>http://www.dougfinke.com/blog/index.php/2007/07/27/embedding-f-in-powershell/comment-page-1/#comment-56455</link>
		<dc:creator>Mr. Spock</dc:creator>
		<pubDate>Mon, 28 Dec 2009 16:25:14 +0000</pubDate>
		<guid isPermaLink="false">http://dougfinke.com/blog/?p=198#comment-56455</guid>
		<description>Very interesting !!
I made some modifications to your code to allow it compile F# into memory. 

Hope it helps:
&lt;code&gt;
#path to FSharp Compiler Provider assembly DLL
$fsharp_codedom = &quot;$env:ProgramFiles (x86)\FSharp-1.9.7.8\bin\FSharp.Compiler.CodeDom.dll&quot;;

#load compiler  assembly
$codedom_assy=[System.Reflection.Assembly]::LoadFrom($fsharp_codedom);

#instantiate compiler and parameters
$compiler = new-object -type Microsoft.FSharp.Compiler.CodeDom.FSharpCodeProvider;
$compilerParameters = new-object -type System.CodeDom.Compiler.CompilerParameters;

#force assembly to be compiled in memory
$compilerParameters.GenerateInMemory=$true;

# FSharp Source
$source=@&quot;
#light
module Strangelights.Fibonacci
let fibs =
    (1,1) &#124;&gt; Seq.unfold
        (fun (n0,n1) -&gt; 
            Some(n0, (n1, n0 + n1)))

let get n = 
    Seq.nth n fibs

&quot;@

$result = $compiler.CompileAssemblyFromSource($compilerparameters,$source);
if ($result.Errors.HasErrors){ $source;$result.Errors;break}

#calling FSharp functions from powershell 
1..40&#124; ForEach { &quot;{0} {1}&quot; -f $_, [Strangelights.Fibonacci]::get($_) }
&lt;/code&gt;</description>
		<content:encoded><![CDATA[<p>Very interesting !!<br />
I made some modifications to your code to allow it compile F# into memory. </p>
<p>Hope it helps:<br />
<code><br />
#path to FSharp Compiler Provider assembly DLL<br />
$fsharp_codedom = "$env:ProgramFiles (x86)\FSharp-1.9.7.8\bin\FSharp.Compiler.CodeDom.dll";</p>
<p>#load compiler  assembly<br />
$codedom_assy=[System.Reflection.Assembly]::LoadFrom($fsharp_codedom);</p>
<p>#instantiate compiler and parameters<br />
$compiler = new-object -type Microsoft.FSharp.Compiler.CodeDom.FSharpCodeProvider;<br />
$compilerParameters = new-object -type System.CodeDom.Compiler.CompilerParameters;</p>
<p>#force assembly to be compiled in memory<br />
$compilerParameters.GenerateInMemory=$true;</p>
<p># FSharp Source<br />
$source=@"<br />
#light<br />
module Strangelights.Fibonacci<br />
let fibs =<br />
    (1,1) |&gt; Seq.unfold<br />
        (fun (n0,n1) -&gt;<br />
            Some(n0, (n1, n0 + n1)))</p>
<p>let get n =<br />
    Seq.nth n fibs</p>
<p>"@</p>
<p>$result = $compiler.CompileAssemblyFromSource($compilerparameters,$source);<br />
if ($result.Errors.HasErrors){ $source;$result.Errors;break}</p>
<p>#calling FSharp functions from powershell<br />
1..40| ForEach { "{0} {1}" -f $_, [Strangelights.Fibonacci]::get($_) }<br />
</code></p>
]]></content:encoded>
	</item>
</channel>
</rss>
