Using the FSharp code compiler in a Windows PowerShell session
<#
$fSharpCode = @ "
Moduletest
Let HelloWorld =
"Hello World!!!!"
printfn "%s" HelloWorld
Let rec Loop n =
seq [
if n <= 0 Then
()
Else
yield N;
yield! Loop (n-1)
] |> seq.sort
printfn "%A" (Loop 5)
Let rec factorial x =
If x = 0 Then 1
Else x * (factorial (x-1))
"@
#>
$env:P Ath = $env:P Ath + "; C:\ProgramFiles\Microsoft sdks\f#\3.0\framework\v4.0 "
Add-type -path C:\FSharpPowerPack-4.0.0.0\bin\FSharp.Compiler.CodeDom.dll
$provider = New-object Microsoft.FSharp.Compiler.CodeDom.FSharpCodeProvider
$fSharpCode = get-content "C:\Users\tj\Desktop\loop.fs" | out-string
$fsharpType = Add-type -typedefinition $fSharpCode -codedomprovider $provider -passthru | where { $_. IsPublic}
$fSharpType :: HelloWorld
$fSharpType :: Loop (9)
$fsharpType ::factorial (9)
############
$env:P Ath = $env:P Ath + "; C:\ProgramFiles\Microsoft sdks\f#\3.0\framework\v4.0 "
Add-type -path C:\FSharpPowerPack-4.0.0.0\bin\FSharp.Compiler.CodeDom.dll
$provider = New-object Microsoft.FSharp.Compiler.CodeDom.FSharpCodeProvider
$fSharpCode 2 = get-content "C:\Users\tj\Desktop\Line.fs" | out-string
$fsharpType = Add-type -typedefinition $fSharpCode 2 -codedomprovider $provider -referencedassemblies @ ("system.drawing";" C:\fsharp-FSharp.Charting\bin\FSharp.Charting.dll ")-passthru| where { $_. IsPublic}
Add-type -path "C:\fsharp-FSharp.Charting\bin\FSharp.Charting.dll"
$fsharpType :: Line
######################
$env:P Ath = $env:P Ath + "; C:\ProgramFiles\Microsoft sdks\f#\3.0\framework\v4.0 "
Add-type -path C:\FSharpPowerPack-4.0.0.0\bin\FSharp.Compiler.CodeDom.dll
$provider = New-object Microsoft.FSharp.Compiler.CodeDom.FSharpCodeProvider
$fSharpCode 3 = get-content "C:\Users\tj\Desktop\Data.fs" | out-string
$fsharpType = Add-type -typedefinition $fSharpCode 3 -codedomprovider $provider -referencedassemblies @ ("C:\FSharp.Data\bin\FSharp.Data.dll")-passthru| where { $_. IsPublic}
Add-type -path C:\FSharp.Data\bin\FSharp.Data.dll
$fsharpType ::http ("http://www.baidu.com")
$fsharpType ::http ("http://www.federalreserve.gov/datadownload/Output.aspx?rel=H15&series= bcb44e57fb57efbe90002369321bfb3f&lastobs=&from=&to=&filetype=csv&label=include&layout= SeriesColumn ")