FSharp.Quotations.Compiler


FSharp.Quotations.Compiler

FSharp.Quotations.CompilerはNuGetからインストールできます:
PM> Install-Package FSharp.Quotations.Compiler

概要

FSharp.Quotations.Compilerは、F#の式木をILにコンパイルして実行するためのライブラリです。

同じようなライブラリには、以下のようなものがあります。

これらのライブラリとFSharp.Quotations.Compilerの大きな違いは、 式木の解析に(再帰ではなく)ループを使っていることです。 そのため、このライブラリはスタックオーバーフローを気にすることなく使えます。

簡単な例

1: 
2: 
#r "FSharp.Quotations.Compiler.dll"
open FSharp.Quotations.Compiler
1: 
2: 
3: 
let expr = <@ 10 + 20 @>
let res = expr.Compile()
printfn "%d" (res.ExecuteCompiledCode())

このコードを実行すると以下のように出力されます:

30

サンプルとドキュメント

  • チュートリアルには、ライブラリのサンプルがあります。
  • 制限事項には、このライブラリの制限事項についての説明があります。
  • APIリファレンスには、このライブラリのすべての型、モジュール、関数についての自動生成されたドキュメントがあります。

コントリビュート

このプロジェクトはGithubでホストされています。 イシューを報告でき、フォークしてプルリクエストを送ることもできます。

このライブラリは、CC0で公開されており、商用、非商用問わず、変更や再頒布可能です。 より詳しい情報は、Githubリポジトリのライセンスファイルをご覧ください。

namespace FSharp
namespace FSharp.Quotations
namespace FSharp.Quotations.Compiler
val expr : Quotations.Expr<int>

Full name: Index.expr
val res : ICompiledCode<int>

Full name: Index.res
member Quotations.Expr.Compile : unit -> ICompiledCode<'T>
val printfn : format:Printf.TextWriterFormat<'T> -> 'T

Full name: Microsoft.FSharp.Core.ExtraTopLevelOperators.printfn
abstract member ICompiledCode.ExecuteCompiledCode : unit -> 'T
Fork me on GitHub