Fixed Tuples heading
[bpt/mlt.git] / doc / manual.tex
index b86c295..beb35d5 100644 (file)
@@ -84,7 +84,7 @@ In addition to SML's $\sim$ prefix negation operator, there is a \$ operator for
 
 Function application is like SML application.
 
-\subsection{Tuples}
+\subsubsection{Tuples}
 
 Tuple and {\tt ()} expressions are handled identically to how they are in SML.
 
@@ -96,6 +96,18 @@ The syntax for creating records and extracting their fields is identical to SML'
 
 Where {\tt temp} is the name of a template in the current project, {\tt @temp} evaluates to a function {\tt (string * string) list -> unit} that takes in a list of name-value pairs for CGI parameters to modify and runs {\tt temp} with those changes. The Compilation Manager will prevent template calls from being used to implement any sort of recursion.
 
+\subsubsection{Anonymous functions}
+
+Anonymous {\tt fn} functions are available with the SML syntax.
+
+\subsubsection{\tt case}
+
+SML {\tt case} expressions are supported.
+
+\subsubsection{\tt raise}
+
+SML {\tt raise} expressions are supported.
+
 \subsection{Patterns}
 
 Patterns are identical to SML patterns without support for user-defined infix constructors, though {\tt ::} is supported. Record patterns can include field names with no assigned patterns (the pattern for such a field is taken to be the field name) and "flex record" {\tt ...}'s to stand for unused fields.
@@ -123,31 +135,25 @@ Variables with reference type are introduced with {\tt ref} declarations, which
 If statements are in the usual imperative style, meaning that else clauses are optional. They are of the form:
 
 \begin{verbatim}
-if (condition1)
-{
+if condition1 then
        block1
-}
-else if (condition 2)
-{
+else if condition 2 then
        block 2
-}
 else
-{
        block 3
-}
+end
 \end{verbatim}
 
-The {\tt block}s are sequences of statements and declarations. Every {\tt if} statement is followed by zero or more {\tt else if}'s and one or zero {\tt else}'s. Conditions must be enclosed in parentheses.
+The {\tt block}s are sequences of statements and declarations. Every {\tt if} statement is followed by zero or more {\tt else if}'s and one or zero {\tt else}'s.
 
 \subsubsection{\tt foreach}
 
 All looping is done via {\tt foreach} statements, which have two forms. One is:
 
 \begin{verbatim}
-foreach (var in exp)
-{
+foreach var in exp do
        block
-}
+end
 \end{verbatim}
 
 Where {\tt exp} has type {\tt t list}, {\tt block} is executed for each of {\tt exp}'s elements, binding {\tt var} to each of them in order from first to last.
@@ -155,43 +161,34 @@ Where {\tt exp} has type {\tt t list}, {\tt block} is executed for each of {\tt
 There is also a shortcut integer iteration form:
 
 \begin{verbatim}
-foreach (var in fromExp .. toExp)
-{
+foreach var in fromExp .. toExp do
        block
-}
+end
 \end{verbatim}
 
 {\tt fromExp} and {\tt toExp} must have type {\tt int}. {\tt block} is evaluated with {\tt var} bound in sequence to each integer in the range defined by {\tt fromExp} and {\tt toExp}.
 
-\subsubsection{\tt case}
+\subsubsection{\tt switch}
 
-{\tt case} statements are straightforward imperative modifications of SML {\tt case} expressions, such as:
+{\tt switch} statements are imperative equivalents of {\tt case} expressions, such as:
 
 \begin{verbatim}
-case (exp)
-(pat1) { block1 }
-(pat2) { block2 }
+switch exp of
+  pat1 => block1
+| pat2 => block2
+end
 \end{verbatim}
 
-The case object and patterns must be enclosed in parentheses.
-
-\subsubsection{{\tt try}..{\tt catch}}
+\subsubsection{{\tt try}..{\tt with}}
 
-This construction is to SML's {\tt handle} what template {\tt case} is to SML {\tt case}. For example:
+This construction is to SML's {\tt handle} what {\tt switch} is to {\tt case}. For example:
 
 \begin{verbatim}
 try
-{
        block1
-}
-catch (pat1)
-{
-       block2
-}
-catch (pat2)
-{
-       block3
-}
+with pat1 => block2
+| pat2 => block3
+end
 \end{verbatim}
 
 \end{document}
\ No newline at end of file