from Hacker News

Programming in Standard ML (2011) [pdf]

by optbuild on 5/26/23, 5:03 AM with 30 comments

  • by jstrieb on 5/27/23, 3:12 AM

    This 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/MPLLang/mpl

  • by azdavis on 5/27/23, 3:59 AM

    For editor support for Standard ML you can try Millet, a language server. https://azdavis.net/posts/millet/

    There’s also https://smlhelp.github.io/book/ which is mostly put together by current/past CMU students.

    Note: I made Millet.

  • by assbuttbuttass on 5/27/23, 2:57 AM

    Standard 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

  • by talhah on 5/27/23, 10:16 AM

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

  • by sn41 on 5/27/23, 3:40 PM

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

  • by AdieuToLogic on 5/27/23, 2:31 AM

    Whenever 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.
  • by nequo on 5/27/23, 3:56 AM

    For 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.
  • by slavapestov on 5/27/23, 3:34 PM

    ML 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.
  • by zelphirkalt on 5/27/23, 1:53 PM

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

  • by mattpallissard on 5/29/23, 6:44 AM

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

  • by GnarfGnarf on 5/27/23, 1:08 PM

    "ML" = Meta Language
  • by wirrbel on 5/27/23, 7:25 AM

    What is a good implementation to write SML on Mac M1? SML NJ didn't work IIRC