O'Reilly logo

ML for the Working Programmer, Second Edition by Larry C. Paulson

Stay ahead with the world's most comprehensive technology and business learning platform.

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, tutorials, and more.

Start Free Trial

No credit card required

8Imperative Programming in ML

Functional programming has its merits, but imperative programming is here to stay. It is the most natural way to perform input and output. Some programs are specifically concerned with managing state: a chess program must keep track of where the pieces are! Some classical data structures, such as hash tables, work by updating arrays and pointers.

    Standard ML’s imperative features include references, arrays and commands for input and output. They support imperative programming in full generality, though with a flavour unique to ML. Looping is expressed by recursion or using a while construct. References behave differently from Pascal and C pointers; above all, they are secure.

    Imperative features are compatible ...

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, interactive tutorials, and more.

Start Free Trial

No credit card required