F# 中的元编程示例
我对用 F# 编写的元编程示例感兴趣,这些示例演示了 F# 特定功能的使用,例如 TryGetReflectedDefinition
函数。
我在哪里可以找到这样的例子?
I'm interested in metaprogramming examples written in F# that demonstrate the use of F#-specific functionality such as the TryGetReflectedDefinition
function in the F# standard library.
Where might I find such examples?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
WebSharper 和 Unquote 是使用引用的开源 F# 库的两个示例(Unquote 并未专门使用
TryGetReflectedDefinition
,但我相信 WebSharper 确实如此)。FSharp.PowerPack.Linq 是另一个示例。另外,我还找到了引用的实现< F# 编译器中的 /a> 是有用且富有洞察力的参考。
WebSharper and Unquote are two examples of open source F# libraries using Quotations (Unquote doesn't specifically use
TryGetReflectedDefinition
, but I believe WebSharper does).FSharp.PowerPack.Linq is another example. Also, I've found the implementation of quotations in the F# compiler to be a helpful and insightful reference.
前段时间,我写了一个项目,使用 MSR Accelerator。
这是一个相当简单的翻译器(与相当复杂的 WebSharper 相比),但它应该演示您感兴趣的大部分功能。特别是,它翻译用
ReflectedDefinition
属性标记的函数。它也来自您最喜欢的科学计算领域:-)Some time ago, I wrote a project that translates F# quotations to GPU code using MSR Accelerator.
This is a fairly simple translator (compared e.g. to WebSharper, which is pretty complex), but it should demonstrate most of the features you're interested in. In particular, it translates functions marked with the
ReflectedDefinition
attribute. It is also from your favorite scientific computing domain :-)