B.10 Structures

The ML module system consists of structures, signatures, and functors. A structure in ML is a collection of related data types and functions akin to a class from object-oriented programming. (Structures and functors in ML resemble classes and templates in C++, respectively.) Multiple predefined ML structures are available: TextIO, Char, String, List, Math. A function within a structure can be invoked with its fully qualified name (line 1) or, once the structure in which it resides has been opened (line 8), with its unqualified name (line 29):

A set of 12 code lines in M L for invoking a function by two ways.
Description
Continuation of the code in M L for invoking a function by two ways, consisting of 18 lines.
Description

To prevent a function from one structure overriding a different function with the same name from another structure in the single program, use fully qualified names [e.g., Int.toString(3)].

..................Content has been hidden....................

You can't read the all page of ebook, please click here login for view all page.
Reset
18.191.176.194