从 .NET/C# 调用 LISP 或 SCHEME
在我现有的软件中,我使用自制决策树实现了遗传编程,该决策树能够在以数组形式提供给它的一些布尔数据中应用基本逻辑运算符(AND OR NOT)。我使用的平台是带有 SQLServer 后端的 .NET / C#。在寻找提高我的遗传程序性能的方法时,我得出的结论是,我需要函数式语言附带的几乎所有附加功能,并且我相信Scheme或较小范围的LISP是最好的解决方案,除非我想实现这样的功能COND、IF、比较运算符等我自己扩展了现有的实现。
我向论坛提出的问题是,是否有任何有效的方法可以从 .NET 应用程序调用 Scheme(或 LISP),以某种数组形式来回传递数据。如果这是不可能的,您是否认为最好硬着头皮从头开始实现它,或者我应该寻找替代方法,例如使用文本文件进行通信?
In my existing software I have an implementation of genetic programing using home grown decission making tree that is able to apply basic logic operators (AND OR NOT) in some boolean data that are provided to it in a form of an array. The platform I am using is .NET / C# with SQLServer back end. Looking for ways to improve the performance of my genetic program I concluded that I need almost all the additional functionality that comes with a functional language and I believe Scheme or to a lesser extend LISP are the best solutions for it unless I want to implement features like COND, IF, comparisson operators etc myself extending the existing implementation.
My question to the forum is if there is any efficient way to call Scheme (or LISP) from a .NET application passing data back and front in some array form. If this is not possible, do you thing that it will better just to bite the bullet and implement it from scratch or I should look for alternative ways, like for example communicating using a text file?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(4)
DLR 有一个符合 R6RS 的方案实现,称为 IronScheme。由于 IronScheme 使用 DLR,因此可以使用标准化 DLR 嵌入 API 将其嵌入到任何 .NET 应用程序中,其方式与嵌入 IronRuby 或 IronPython 的方式完全相同:
可以在 IronScheme 的作者 leppie 的博客文章。它还展示了如何将 C# lambda 传递给 Scheme 高阶函数和其他很酷的东西。
There is an R6RS compliant Scheme implementation for the DLR called IronScheme. Since IronScheme uses the DLR, it can be embedded into any .NET application using the standardized DLR embedding APIs in exactly the same way that you would embed, say, IronRuby or IronPython:
The full snippet can be found in a blog post by IronScheme's author, leppie. It also shows how to pass a C# lambda to a Scheme higher-order function and other cool stuff.
除非您使用 IronScheme(上面),否则我可能会使用 ZeroMQ(它同时具有 Common Lisp 和 .Net 驱动程序)之类的东西在两个系统之间传递消息。
Unless you go with IronScheme (above), I'd probably use something like ZeroMQ (which has both Common Lisp and .Net drivers) to pass messages between the two systems.
我构建了一个轻量级的、可嵌入的类似Scheme的语言解释器,正是为了复杂且可重用的配置。它占用空间小(约 1500 行代码),并且不会向您的应用程序引入任何其他依赖项。
我在工作中将其开源。它称为 schemy。这里还有示例应用程序演示如何在真的很复杂的方式。
我还在这个 stackoverflow 答案中提供了构建它的一些详细动机。
希望它有帮助:)
I built a lightweight, embeddable Scheme-like language interpreter exactly for the purpose of complex and re-usable configuration. It has a small footprint (~1500 line of code) and does not introduce any other dependency to your application.
I open-sourced it from work. It's called schemy. Here is also an example application demonstrating how to use it in really complex way.
I also provided some detailed motivation behind building it for work in this stackoverflow answer.
Hope it helps:)
为什么不看看 F#?
(www.fsharp.net)
它基本上是 .Net 中 OCaml 的改编版。
或者您始终可以使用 IronScheme,但我认为它还不够成熟。
Why not look at F#?
(www.fsharp.net)
It's basically an adaptation of OCaml in .Net.
Or you can always use IronScheme, but I don't think it's as mature.