One Emacs SML Workflow

Being partial to the full-REPL-reboot style of development (ala DrRacket) for most situations I wanted the same thing in Emacs with sml-mode. The value add is that you know all of your files are saved and that your environment is in a fresh and known state. I came up with this:

(defun gcr/sml-eval-buffer ()
  "Intelligently evaluate a SML buffer."
  (let ((sml-process (get-process "sml")))
    (when sml-process
      (quit-process sml-process)))
  (sleep-for 0.25)
  (let ((sml-buffer (get-buffer "*sml*")))
    (when sml-buffer
      (kill-buffer sml-buffer)))
  (sml-prog-proc-load-file buffer-file-name t))

Only to be delighted (though not surprised) to find yet another nearly identical approach here by wenjun.yan:

(defun isml ()
  "If sml repl exists, then restart it else create a new repl"
  (when (get-buffer "*sml*")
    (with-current-buffer "*sml*"
      (when (process-live-p "sml")
    (sleep-for 0.2))
  (sml-run "sml" ""))

My urge to attain Emacs Comint mastery only grows.

One Path to SML

Never knowing what is the right time for a path to present itself, I think I am back on the path to SML again. This time I got some more feedback and wanted to capture it here.

Various feedback:

We’ll see what is my cup of tea.

A Slow Study Group for ML


I’m going to work through




The reason is that I’ve never learned a statically typed functional programming language, I feel weak on recursive data type definitions, and I am curious about compiler and interpreter construction. So, I’m looking for a way to learn about all 3 at once.

Why ML?

  1. Proven, excellent pedagogical language with great resources.
  2. Smaller than OCaml, F#, and Haskell; so I won’t get distracted with tons of “stuff”
  3. Puts me in a good position if I wanted to use it “for real” that OCaml, F#, Haskell, or even Scala and some other ML in Java languages would be a good follow up path in terms of leveraging the investment.

Basically when I sit down to learn the basics of anything from #2 I feel like they assume you know the basics of ML, and well, I don’t!

Let me know if you want to review problems together.