SML 有何用途?

发布于 2024-07-16 17:35:40 字数 1432 浏览 7 评论 0原文

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(7

用心笑 2024-07-23 17:35:41

在工作中,我们在交付给付费客户的实际软件产品中使用 SML。 我们使用 MLton 将 SML 代码编译为在 Windows、Linux、Solaris、AIX 和 HP-UX 上运行的本机代码。 它运作良好,我们对我们的选择感到满意。

我不认为 SML 特别适合任何明确的利基市场。 事实上,SML 是一种非常全面的通用编程语言。 Prolog 在逻辑编程/人工智能/基于规则的系统解决领域已经很成熟,但是它被用来除了这些传统领域之外,还有很多事情

对于任何正在考虑在“现实世界”中使用 SML 进行软件项目的人,以下是我们迄今为止注意到的一些优点和缺点:

  • 模块系统
  • SML 是一种非常好的通用编程语言,尤其是MLton 优化的 很好,您可以自由地使用抽象而不会损失性能。
  • 我们的旧代码是用纯 C 编写的。我们可以用 SML 逐段替换它,将 C 和 SML 代码链接到相同的可执行文件。
  • SML/NJ 提供快速开发的 repl
  • 可移植到我们所有的平台

缺点:

  • 用户基数极小
  • 缺乏支持工具区域(IDE、代码文档、调试器等)
  • 我必须亲自将 MLton 移植到 AIX 和 HP-UX

At work, we use SML in actual real-life software products which we ship to paying customers. We use MLton to compile our SML code to native code running on Windows, Linux, Solaris, AIX, and HP-UX. It works well, and we're happy with our choice.

I don't see SML as particularly suited to any clear niche. Indeed, SML is a very well-rounded general-purpose programming language. Prolog is well established in the logic programming/artifical intelligence/rule based system solving niche(s), but it's used for a lot of things besides these traditional domains.

For anyone who is considering using SML for a software project in the "real world", here are some of the advantages and disadvantages we've noticed so far:

  • SML is a very nice general programming language, especially the module system rocks
  • MLton optimizes so well that you can use abstractions freely without losing performance
  • Our old code is written in plain C. We can replace that piece by piece with SML, linking both C and SML code to the same executbles.
  • SML/NJ provides a repl for rapid development
  • Portable to all of our platforms

Disadvantages:

  • Miniscule user base
  • Lacking in the supporting tools area (IDE, code documentation, debuggers, etc.)
  • I had to actually port MLton myself to AIX and HP-UX
浪菊怪哟 2024-07-23 17:35:41

ML 不能直接与 Prolog 相比较。 Prolog 是一种声明性逻辑编程语言,基本上是使用 Horn 子句的定理证明器。 (非纯 Prolog)的优点之一是它允许您在编译或运行时严重修改程序。 例如,在大多数现代 Prolog 实现中,您可以使用 DCG(定子句语法)形式直接编写语法。 使用“-->”的语法规则 使用术语扩展将运算符重写为 Prolog 子句。 例如:

a(N) --> b, c(N).

将被重写为:

a(N,P0,P2) :- b(P0,P1), c(N,P1,P2).

位置变量的使用强制箭头右侧的子节点的邻接性。 由于 Prolog 将尝试通过证明子句(通过回溯)来证明子句的核心部分,因此您基本上拥有一个自上而下的左右解析器,无需任何额外的工作。 程序修改的另一个示例是(动态)事实或子句的断言或撤回,其可用于修改程序在运行时的行为。

另一方面,机器学习是一种不纯粹的函数式语言。 Prolog 和 ML 之间的联系是一些定理证明器是用 ML 编写的。 我想说 ML 的通用性要高得多,但就其利基市场而言,Prolog 非常方便。 两者都非常有用,即使只是为了拓宽视野。

ML is not directly comparable to Prolog. Prolog is a declarative logics programming language that is basically a theorem prover using Horn clauses. One of the nice characteristics of (non-pure Prolog) is that it will allow you to modify a program severely during compile or runtime. For instance, in most modern Prolog implementations you can directly write grammars using the DCG (definite clause grammar) formalism. Grammar rules using the '-->' operator are rewritten to Prolog clauses using term expansion. E.g.:

a(N) --> b, c(N).

Will be rewritten to:

a(N,P0,P2) :- b(P0,P1), c(N,P1,P2).

The use of position variables enforce adjacency of the daughters on the right hand side of the arrow. Since Prolog will try to prove the head of a clause by proving its daughters (by backtracking), you basically have a top-down left-right parser without any additional work. Another example of program modification is the assertion or retraction of (dynamic) facts or clauses, which can be used to modify the behavior of a program at runtime.

ML on the other hand is an impure functional language. The connection between Prolog and ML is that some theorem provers are written in ML. I'd say ML is far more general-purpose, but for its niches Prolog is a very convenient. Both are very useful to learn, even just for just widening your horizons.

甜心 2024-07-23 17:35:41

SML 由编译器编写者使用。 Prolog 和 SML 都用于定理证明。

SML is used by compiler writers. Both Prolog and SML are used in theorem provers.

夜灵血窟げ 2024-07-23 17:35:41

卡内基梅隆大学的 FoxNet 项目 是使用 SML 构建的。

Jane Street 自营贸易公司使用 O'Caml 为其自己内部构建的软件。

Laurance C. Paulson 是《ML for theworking Programmer》一书的作者,他使用 SML 构建了 Isabell,一个 LCF 定理证明器。

教授兼 Haskell 专家 Philip Wadler 维护着一份使用函数式编程的现实世界项目列表,其中包括使用 ML 的项目,位于
http://homepages.inf.ed.ac.uk/wadler/realworld/

The FoxNet project from Carnegie Mellon Univ is built using SML.

Jane Street Proprietary trading company, use the O'Caml for their own in-house built software.

Laurance C. Paulson, the author of ML for the Working Programmer, used SML to build Isabell, an LCF theorem prover.

Philip Wadler, a professor and Haskell expert, maintains a list of real world projects that use Functional Programming, among these projects are ones that use ML, located at
http://homepages.inf.ed.ac.uk/wadler/realworld/

一个人的旅程 2024-07-23 17:35:41

我个人只在大学的数论课程中使用过它。
我不得不说我真的很喜欢使用它。 它可以处理大量数字,这在处理密码学时非常有用。

如果重要的话我正在使用莫斯科 ML
http://www.itu.dk/people/sestoft/mosml.html

I have only personally used it in university for a number theory course.
I have to say I really enjoyed using it. It could handle huge numbers which was nice when dealing with cryptography.

If it matters I was using Moscow ML
http://www.itu.dk/people/sestoft/mosml.html

漫漫岁月 2024-07-23 17:35:41

我还没有看到很多 ML 的商业应用,但这可能取决于可用的环境,而不是对语言的反映。 我见过许多银行使用 F#(与 ML 属于同一家族)来处理数据流、进行矩阵代数计算并寻找模式。 Microsoft 将其打包用于 .NET 的事实显然无济于事。

I haven't seen many commercial applications of ML, but this may be down to the available environments, rather than a reflection on the language. I've seen a number of banks using F# (which is the same family as ML) to process data streams, do matrix algebra and look for patterns. The fact that Microsoft have packaged it for .NET obviously helps no end.

年华零落成诗 2024-07-23 17:35:41

OCAML 不是 SML,但密切相关,它已用于多种用途:

http://caml.inria.fr/about/successes.en.html

我更喜欢“西方更快的傅立叶变换”,其中机器学习用于生成优化的 C...

Not SML, but closely related, is OCAML, which has been used for a number of things:

http://caml.inria.fr/about/successes.en.html

I rather like the "Faster Fourier Transform in the West" where ML is used to generate optimised C...

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文