Hi,
as far as I know there is no built-in support for evaluating quotations (or even compiling & executing them) directly, however for some cases you can use the LINQ "Compile" feature - LINQ is a new feature in .NET 3.5, which contains "expression trees" that represent similar thing as F# quotations and that provide a "Compile" method for turning them into executable code. F# distribution contains a sample (FLinq) that translates subset of F# quotations to the LINQ expression trees, which can be then compiled & executed.

There are some information about this approach in a paper available here:
[link:research.microsoft.com]

This is of course limited only to certain quotations, but it could help...

By on 3/17/2008 2:20 AM ()

You can use the reflected definition attribute instread of <@ @>. In this case the compiler will generate both the real function and quotation:

1
2
[<ReflectedDefinition>]
let poly x = x+2.0*x+3.0/(x*x)

There's a nice example of this in Expert F# p253.

Cheers,
Rob

By on 3/17/2008 4:25 AM ()

Thanks Tomas and Robert -- useful info.
~TMSteve

By on 3/24/2008 1:46 PM ()
IntelliFactory Offices Copyright (c) 2011-2012 IntelliFactory. All rights reserved.
Home | Products | Consulting | Trainings | Blogs | Jobs | Contact Us | Terms of Use | Privacy Policy | Cookie Policy
Built with WebSharper