9 ms·
Programming in Standard ML (2011) [pdf]
- AdieuToLogic 3y agoWhenever I see a Standard ML article/paper, it always reminds me that I still need to learn OCaml. Not that one is better than the other, just that I've not gotten around to learning OCaml yet.
- bmitc 3y agoI recommend F#. :)
- smasher164 3y agoRegardless, I would prioritize learning OCaml. The only thing SML has going for it is nicer syntax, and less stapled-on OOP stuff. OCaml's better in almost every way for day-to-day programming.
- jstrieb 3y agoThough I know far more about SML than OCaml, I would approximate that the former is to C as the latter is to C++. Which one you learn should depend on what you plan to use it for! I'm partial to SML. Then again, I've only written a handful of real-world programs with it.
- cmrdporcupine 3y agoI feel like ... SML is the better language but OCaml is the better runtime/community. Sad.
- WastingMyTime89 3y agoSML definitely has a nicer formal definition but OCaml has better performance and a lot more functionalities. I wouldn’t say SML is the better language but the syntax definitely is cleaner. Strangely I think SML focus on being well defined and tidy is why it never really took off. A language success is linked to its community and your features define who will want to join you. It seems to me that at the beginning it’s better to attract tinkerers than perfectionists.
- yakubin 3y ago> OCaml has better performance That statement needs some evidence. > a lot more functionalities Past a certain minimal threshold of needed functionality, I prefer a language not to have a couple good features than to have a really bad one, like implementation inheritance, particularly multiple inheritance.
- deleted 3y ago[deleted]
- yakubin 3y agoNot necessarily. E.g. SML has had multicore since forever. In OCaml it’s the hot new thing now, which probably needs some time in the wild before everything is ironed out.
- cmrdporcupine 3y agoOk that's interesting, I hadn't realized the multicore story there was better. Back when I was more into looking at this kind of thing (uh, 20 years ago?) I wrote a few simple programs in SML/NJ and far preferred its syntax to OCaml. But even back then, OCaml had more dev community momentum. (Actually Haskell seemed to have even more momentum but I never ever found it readable or comprehensible as a mere mortal.) At the time for what I was doing, I really wanted... SML but without a garbage collector, operating for systems level programming. And so I was excited when Graydon Hoare started what became Rust. Which is what I prefer to work in these days. Still, if I wanted a language for higher level development, I really would prefer to reach for something in the ML family of languages, they are just very expressive. But I wouldn't do this for paid employment work, too esoteric. Maybe that will change a bit now that Rust has brought some concepts and syntax from ML to the mainstream.
- le-mark 3y ago> Not necessarily. E.g. SML has had multicore since forever. Can anyone say which implementation specifically?
- cyberbanjo 3y agoPolyMl is one https://polyml.org/ https://polyml.org/
- fweimer 3y agoOCaml is a much larger language than SML. SML feels cleaner in some ways. For example, it has overflow checks (or infinite precision) for integer arithmetic. (Although OCaml no longer has writable string literals …) SML has multiple, mostly independent implementations with different characteristics. Poly/ML had multi-processor support well before OCaml. But OCaml development is certainly much more active.
- dunefox 3y agoOr Flix: https://flix.dev/ https://flix.dev/
- de_keyboard 3y ago> Flix looks like Scala, but its type system is based on Hindley-Milner. Ahh why?! Scala is FP larping as OOP. Great type system, poor syntax.
- slavapestov 3y agoML is notable for its higher-order module system, which solves the same problems but is different than the type classes/protocols/traits of Haskell/Swift/Rust.
- assbuttbuttass 3y agoStandard ML is a very elegant language. It's one of the few languages that has a type system that actually makes sense. For something truly mind bending, try understanding this implementation of printf in SML: http://mlton.org/Printf http://mlton.org/Printf
- jstrieb 3y agoThis is both a comprehensive guide, and an excellent reference! I use it often when writing SML for side projects. For those interested in parallel, functional programming, I recommend taking a look at Futhark, which leverages data parallelism to make very fast parallel programs. It is based on SML, and has similar syntax, but can automatically build programs that (among other targets) run on the GPU using CUDA or OpenCL. It is also worth checking out MPL, which extends the (already awesome) whole-program optimizing compiler MLton to add support for nested, fork-join parallelism. https://github.com/diku-dk/futhark https://github.com/diku-dk/futhark https://github.com/MPLLang/mpl https://github.com/MPLLang/mpl
- smonn_ 3y agoThanks a lot for the recommendation, it's exactly what I was looking for :)
- nequo 3y agoFor those running Debian or Ubuntu and interested to try the Standard ML of New Jersey, $ sudo apt install smlnj $ sml Standard ML of New Jersey v110.79 [built: Sat Oct 26 12:27:04 2019] - and you can hit the ground running.
- fweimer 3y agoYou should be aware of this: $ file /usr/lib/smlnj/bin/.run/run.x86-linux /usr/lib/smlnj/bin/.run/run.x86-linux: ELF 32-bit LSB pie executable, Intel 80386, version 1 (SYSV), dynamically linked, interpreter /lib/ld-linux.so.2, BuildID[sha1]=b5e686ed7f390da7dfe58f0227cec46fd0e4fb95, for GNU/Linux 3.2.0, stripped Debian hasn't packaged the 64-bit port of smlnj yet (in 110.94 and later). Both polyml and mlton have amd64 support, though.
- azdavis 3y agoFor editor support for Standard ML you can try Millet, a language server. https://azdavis.net/posts/millet/ https://azdavis.net/posts/millet/ There’s also https://smlhelp.github.io/book/ https://smlhelp.github.io/book/ which is mostly put together by current/past CMU students. Note: I made Millet.
- wirrbel 3y agoWhat is a good implementation to write SML on Mac M1? SML NJ didn't work IIRC
- porcoda 3y agoPolyML is what I use.
- talhah 3y agoDoes anyone here actually use SML for production or know of big projects (outside of academia) which uses it? Compared to other functional langauges, it doesn't seem as popular.
- rabbits77 3y agoAnecdotally, most people use SML as part of academic projects and when they do to use it for commercial projects end up going to Ocaml or Haskell. That is because of the wider ecosystem of projects to support practical things like talking to databases, networking, etc. Also larger communities for documentation and help debugging issues that only come up once you start scaling out.
- jstrieb 3y agoI've used it for a handful of personal CLI applications. Not sure if that counts as "production," though.
- GnarfGnarf 3y ago"ML" = Meta Language
- zelphirkalt 3y agoI found the initial example of a regex package hard to follow. I don't know the language and am confronted with this example, that makes use of many advanced capabilities of the language. Instead I looked for a book for beginners in Standard ML and found "Elements of ML Programming" to be quite good.
- sn41 3y agoThere are some allusions here I think. The opening line of part 2, "All Standard ML is divided into two parts." is a very strange English sentence to write. It actually sounds like the very famous opening line of Julius Caesar's "Commentary on the Gallic War" (which is prescribed as a model of Latin composition) "All Gaul is divided into three parts..." [1] https://en.wikisource.org/wiki/Commentaries_on_the_Gallic_War/Book_1 https://en.wikisource.org/wiki/Commentaries_on_the_Gallic_Wa...
- mattpallissard 3y agoI've loved SML ever since I worked through Okasaki's "Purely functional datastructures". I use OCaml over SML these days although I've always thought that SML had slightly nicer syntax.