



Review:Elements of ML Programming
Elements of ML Programming | |
author | Jeffrey D. Ullman |
pages | |
publisher | Prentice Hall |
rating | 8 |
reviewer | A.M. Kuchling |
ISBN | |
summary | A quite technical (but not boring) book that covers functional programming in ML. |
This slim book is a fine introduction to the ML programming language, and is worth reading by anyone interested in learning about functional programming. It starts off by teaching you about simple expressions and ML's basic data types, covers writing recursive functions to perform common tasks, and by the end is discussing data structures and information hiding. There are lots of examples and exercises, which you can try out by downloading the SML/NJ implementation. Ullman's writing style is simple and clear, so it's not difficult to understand, and I really enjoyed reading it (sadly a rarity with technical books these days).
ML is mostly a functional language, though it supports some degree of imperative programming, and is an elegant system worth attention. The language has some novel features; my favorite is its automatic type inference. A friend of mine once observed that many programming bugs stem from type mismatches, and points out that because of ML's strict type inference and checking, once you get an ML program to compile successfully it often produces correct results. (Getting to the point of compiling correctly, however...) For example, look at the following interaction with the SML/NJ interpreter:
- fun sumlist( nil ) = 0
= | sumlist( x::xs ) = x + sumlist(xs);
val sumlist = fn : int list -> int
ML is smart enough to figure out that the resulting
sumlist
function takes a list of integers as input ('int
list') and returns an integer ('-> int'). It can therefore report an
error if you attempt to pass it a list of real numbers:
- sumlist( [1,2,3] );
val it = 6 : int
- sumlist( [1.0,4.0,2.0] );
stdIn:31.1-31.25 Error: operator and operand
don't agree [tycon mismatch]
operator domain: int list
operand: real list
in expression:
sumlist (1.0 :: 4.0 :: 2.0 :: nil)
Even though it may be unlikely that you'll write a large program in ML or get a job through your ML knowledge, that should matter to market-driven drones. Hackers should read this book because it demonstrates a style of programming which will twist your thinking around, and benefit your programming in more conventional languages.
But this book over here.
Table of Contents
- A Perspective on ML and SML/NJ
- Getting Started in ML
- Defining Functions
- Input and Output
- More About Functions
- Defining Your Own Types
- More About ML Data Structures
- Encapsulation and the ML Module System
- Summary of the ML Standard Basis
Review:Elements of ML Programming More Login
Review:Elements of ML Programming
Related Links Top of the: day, week, month.
Slashdot Top Deals