NEXT ·  UP ·  PREVIOUS ·  CONTENTS ·  INDEX

Simple applicative programming

Standard ML is an interactive language. Expressions are entered, compiled and then evaluated. The result of evaluation is displayed and the next expression may then be entered. This interactive style of working combines well with Standard ML's type inference mechanism to empower the programmer to work in a flexible, experimental way, moving freely from defining new functions to trying the function on some test data and then either modifying the function or moving on to define another.

The fact that types are assigned by the compiler also has the favourable consequence that Standard ML functions are usually shorter than comparable routines implemented in languages in which the types of variables must be supplied when the variable is declared.

We will begin to investigate applicative programming by inspecting values, expressions and functions. The functions defined are short and we will not spend much time describing the tasks to be computed since they will often be self-evident. Some simple and generally useful functions are pre-defined in Standard ML; these include arithmetic functions and others for processing strings and characters. These pre-defined functions are said to be in the initial SML basis , or environment. In addition, the language also provides a library  which makes available other functions, values and types.


 
NEXT ·  UP ·  PREVIOUS ·  CONTENTS ·  INDEX