Programming Languages and Paradigms

Resources

Standard ML

Standard ML is a safe, modular, strict, functional, polymorphic programming language with compile-time type checking and type inference, garbage collection, exception handling, immutable data types and updatable references, abstract data types, and parametric modules. It has efficient implementations and a formal definition with a proof of soundness.

For more information:

Recommended gentle introductions:

Recommended books and other documents:

Performance comparison between C++, Java, OCaml, SML

For an interesting recent comparison between programming languages see the Ray tracer language comparison. Some older articles:

Programming Contests

Once you have mastered SML, you may be intrigued by the ICFP Programming contest held every year. Check it out here! Note that this contest does not require you to program in a functional language, but nevertheless many people choose a functional language.

Using SML in emacs or xemacs:

Documentation for sml-mode
Files for sml-mode (sml-mode)


Instructions: Copy the files for sml-mode into your load-path: /home/user/yourname/yourdir/ Then, add the following into your emacs or xemacs init.el file:
;; SML Mode ;; ============================ (setq load-path (cons "/home/user/yourname/yourdir" load-path)) (autoload 'sml-mode "sml-mode" "Major mode for editing SML." t) (setq sml-mode-info "~/yourdir/sml-mode/sml-mode.info") (setq auto-mode-alist (append '(("\\.cm$" . sml-mode) ("\\.fun$" . sml-mode) ("\\.sml$" . sml-mode) ("\\.sig$" . sml-mode) ("\\.ML$" . sml-mode)) auto-mode-alist)) (add-hook 'sml-load-hook '(lambda () (require 'sml-font))) (defun delete-gc-message () (beginning-of-line 0) (if (looking-at ".*\\(GC #[0-9]+[\.[0-9]+]*: *([0-9]* ms)\C-m*\n\\)") (delete-region (match-beginning 1) (match-end 1)))) (defun comint-filter-sml-gc-messages (foo) (save-excursion (goto-char comint-last-output-start) (delete-gc-message))) (add-hook 'inferior-sml-mode-hook (lambda () (add-to-list 'comint-output-filter-functions 'comint-filter-sml-gc-messages)))

How to use SML within emacs or xemacs:

  • Start emacs or xemacs (ideally in the directory where your sml-code resides)
  • Load a sml-file.
  • Type M-x sml. This will start a "sml" process in the background.
  • Switch to buffer *sml*. Now you can start programming within emacs or xemacs.

How to change the printing depth in SML 110.55?

If you want to print back the results of some evaluation and you only see # where you expect some expression, then you may want to change the print depth of the sml compiler. Control.Print.printDepth controls the printing depth.
Control.Print.printDepth := 100; will set it to 100. Control.Print.printLength controls the printing length.
Control.Print.printLength := 100; will set it to 100.

Alternatively, you can set the depth at startup using the -Cxxx=yyy command line switch: sml -Cprint.depth=100 Run sml -H to see a list of all such options.

Class Schedule

Tuesdays 11:05-13:25
Thursdays 11:05-12:55
McConnell Rm. 13

Contact

Mark Mercer
Office:Rm 106 McConnell