What is SML used for? [closed]
Asked Answered
A

7

20

What are the uses of SML in the real word?

Are its practical uses similar to that of Prolog?

Aroid answered 7/4, 2009 at 8:1 Comment(0)
P
27

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
Poult answered 1/5, 2009 at 19:0 Comment(0)
C
6

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.

Connotation answered 14/4, 2009 at 22:12 Comment(0)
R
3

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

Rooseveltroost answered 7/4, 2009 at 8:14 Comment(0)
O
2

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/

Overriding answered 30/1, 2012 at 8:44 Comment(0)
I
1

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

Irresponsible answered 7/4, 2009 at 8:7 Comment(0)
K
1

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.

Kenny answered 7/4, 2009 at 8:14 Comment(0)
A
1

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...

Arbour answered 7/4, 2009 at 8:27 Comment(0)

© 2022 - 2024 — McMap. All rights reserved.