StandardML is the most practical functional programming language IMO. It concedes that mutation improves performance, laziness is hard for humans to optimize, and side effects exist. At the same time, it has avoided the weirdness of Ocaml or the unnecessary complexity of F#.
It's use of structural typing (like Typescript) rather than nominal typing is great. It winds up feeling a lot like a scripting language, but with better type safety than most non-scripting languages. The CML (concurrent ML) proposals are also much more mathematically grounded, consistent, and nice to use compared to most other languages.
It's such a lovely introduction to Ocaml and programming in general and has a free online textbook. It's a lot of videos but each one is 5-10 minutes so it's very easy to hop in and out.
Which in turn compiles itself into Javascript, such that you can run the SMLtoJS compiler in the browser, e.g. it should be possible to make it accept <script> tags with SML code.
Standard ML is pretty simple and easy to pick up, but a weak point is the lack of { record with updatedValue } syntax to create a new record which is the same as an existing one but with some value changed. You have to specify every field in the record which can be a pain depending on how large your record is.
Standard ML has some nice features though and I think what I mentioned is the only serious shortcoming (except for ecosystem if that's important to you).
Standard ML is also structurally (but strongly) typed, unlike F# and the vast majority of nominally typed languages, which is rare but nice.
type person = { age : int, name : string }
is the same as the type
type animal = { age : int, name = string }
but this hasn't been an issue foe me, and structural typing means you can avoid defining the type at all which is convenient for small records.
For example, a function to increment age has no need for you to define the type.
fun grow { name, age } = { name = name, age = age + 1 }
I think Standard ML helps you understand the origin of some common FP idioms. Like tuples are really just records and SML treats them as such. The empty record {} is the same as the empty tuple (): both are the unit type. And a record like { 1 : "a", 2 : "b" } is exactly the same as the tuple ("a", "b").
There was a time when F# was just an OCaml extension for .NET, but it has developed a lot since.
You may not find a lot of in-depth comparisons between F# and Standard ML, because Standard ML isn't widely mentioned outside of academic research. But you do find comparisons between F# and OCaml, and that may paint a very similar picture:
The most significant differences I can think of are:
1) Standard ML and OCaml have a higher-order module system, and F# has interfaces that you can parameterise over generics.
2) The OCaml ecosystem is functional code on top of functional code, and F# is made to interact with non-functional code on .NET. (As for Standard ML, there isn't much of an ecosystem.)
Unless you are targeting browser, not using .NET as back-end for F# seems like a poor idea as you really are sacrificing the tooling and a lot of performance.
I got tricked up by the acronym. This compiles the programming language "Standard ML [Meta Language]" to the programming languages Lua or JavaScript. It's not a machine learning compiler.
those of us interested in the ML language family have been disappointed for years every time a headline turns out to be yet another machine learning thing, so I'm glad to see this one was actually an ML (:
weatherlight|1 year ago
It was my introduction to typed FP concepts via this course (Part A) https://www.coursera.org/learn/programming-languages
hajile|1 year ago
It's use of structural typing (like Typescript) rather than nominal typing is great. It winds up feeling a lot like a scripting language, but with better type safety than most non-scripting languages. The CML (concurrent ML) proposals are also much more mathematically grounded, consistent, and nice to use compared to most other languages.
mattpallissard|1 year ago
Chris okasaki's purely functional data structures is an excellent intro to SML if your familiar with FP already.
Hirrolot|1 year ago
_delirium|1 year ago
ihumanable|1 year ago
It's such a lovely introduction to Ocaml and programming in general and has a free online textbook. It's a lot of videos but each one is 5-10 minutes so it's very easy to hop in and out.
humzashahid98|1 year ago
There is also MLKit's SMLtoJs which compiles to Javascript, but not to Lua.
https://github.com/melsman/mlkit/blob/master/README_SMLTOJS....
dybber|1 year ago
sgt_bilko|1 year ago
(Standard for readable for me is ReScript)
psd1|1 year ago
The cost of moving from VSCode to neovim has always put me off, but if I could write the config in F# it would tempt me more.
How far is standard ML from F#?
Is there any existing compiler for F# => Lua?
humzashahid98|1 year ago
Standard ML has some nice features though and I think what I mentioned is the only serious shortcoming (except for ecosystem if that's important to you).
Standard ML is also structurally (but strongly) typed, unlike F# and the vast majority of nominally typed languages, which is rare but nice.
type person = { age : int, name : string }
is the same as the type
type animal = { age : int, name = string }
but this hasn't been an issue foe me, and structural typing means you can avoid defining the type at all which is convenient for small records.
For example, a function to increment age has no need for you to define the type.
fun grow { name, age } = { name = name, age = age + 1 }
I think Standard ML helps you understand the origin of some common FP idioms. Like tuples are really just records and SML treats them as such. The empty record {} is the same as the empty tuple (): both are the unit type. And a record like { 1 : "a", 2 : "b" } is exactly the same as the tuple ("a", "b").
sshine|1 year ago
There was a time when F# was just an OCaml extension for .NET, but it has developed a lot since.
You may not find a lot of in-depth comparisons between F# and Standard ML, because Standard ML isn't widely mentioned outside of academic research. But you do find comparisons between F# and OCaml, and that may paint a very similar picture:
https://jkone27-3876.medium.com/comparing-ocaml-to-f-f75e4ab...
The most significant differences I can think of are:
1) Standard ML and OCaml have a higher-order module system, and F# has interfaces that you can parameterise over generics.
2) The OCaml ecosystem is functional code on top of functional code, and F# is made to interact with non-functional code on .NET. (As for Standard ML, there isn't much of an ecosystem.)
neonsunset|1 year ago
lysecret|1 year ago
programjames|1 year ago
hayley-patton|1 year ago
zem|1 year ago
fortyseven|1 year ago