Is it easily possible to run a F# script from within (and in the context) of a C# Application (host).
With 'in the context' I mean the following should be true:
Basically I'm am looking for an API similar to this hypothetical API call
FSharpScriptRunner.RunInContext(string script);
Please help.
-Matthias
The F value is used in analysis of variance (ANOVA). It is calculated by dividing two mean squares. This calculation determines the ratio of explained variance to unexplained variance. The F distribution is a theoretical distribution.
To perform F-Test, go to the Data menu tab, and from the Data Analysis option, select F-Test Two-Sample Of Variances. Select both the data population in the variable 1 and 2 range, keeping alpha as 0.05 (Standard for 95% probability). This will give us a final F-Test Calculation.
There is currently no such api, but you can pretty easily do something similar in a couple of steps:-
1) Use the F# CodeDom, (FSharp.Compiler.CodeDom.dll) available in the powerpack, to dynamically compile your script. The power pack contains apis to compile a single file and to allow you to add references to your current application, thus give the script access to the classes, properties, and methods of the host application.
2) At the end of the compilation stage you should have a dynamic assembly in memory. You can then use reflection to create a dynamic instance of an object from your script and execute it.
Why don't you just compile the F# code into an assembly then reference that from your C# app?
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With