Skip to content
wangp edited this page Jul 9, 2017 · 19 revisions

Here is a rough outline for a tutorial that I think we could write together on the wiki. Feel free to rearrange into an order makes more sense to you, add new suggestions, or write a page yourself. You don't have to be a Mercury developer! It's a tutorial, it doesn't need to be rigorous. It's a wiki, the writing doesn't need to be high quality.

The expected audience is someone with some or a lot of programming experience, possibly in functional programming languages, probably not proficient in Prolog.

  • Hello, World!

    • basic program structure
    • compiling and running
    • brief introduction to state variables
  • Factorial

    • function syntax
    • variables
    • if-then-else
    • recursion
    • builtin ints, integer arithmetic
  • Comments

  • Terms and variables

  • Builtin types

    • int, float, string, char
    • tuples
    • state-of-the-world
    • type conversion
  • Discriminated unions

  • Equivalence types

  • Predicates and functions

  • Basic goals

    • conjunction, disjunction, negation, true, fail, etc.
  • unification algorithm

  • Lists

  • input and output

    • something about purity
    • formatted output
    • example: read from standard input
    • example: reversing words per line
    • example: reading/writing files
    • example: data terms
  • RPN calculator

  • Zebra puzzle

  • uniqueness

  • higher-order programming

    • foldl
    • currying
    • lambda
  • maps

  • sets

  • processing command line options

  • modules

    • interface and implementation
    • imports
    • module qualification
    • building multi-module programs (mmc --make, mmc -f)
    • sub modules
    • nested modules
    • mutable variables
  • more on types (separate pages for each)

    • abstract types (needs modules to make sense)
    • record syntax
    • univ
    • existentially-quantified types
    • user-defined equality and comparison
  • type classes

  • exceptions

  • purity

  • trace goals

  • FFI

  • concurrency

  • debugging

  • profiling

  • insts

  • glossary

Clone this wiki locally