Bool structure provides some basic operations on boolean values.
datatype bool = false | true
val not : bool -> bool
val toString : bool -> string
val scan : (char, 'a) StringCvt.reader
-> (bool, 'a) StringCvt.reader
val fromString : string -> bool option
scan getc strm
"false"are converted to the corresponding boolean values. On successful scanning of a boolean value,
, where b is the scanned value and rest is the remaining character stream.
The second form scans a boolean from a string s. It returns
for a scanned value b; otherwise it returns
NONE. The function
fromString is equivalent to
bool type is considered primitive and is defined in the top-level environment. It is rebound here for consistency.
In addition to the
not function presented here, the language defines the special operators
orelse, which provide short-circuit evaluation of the AND and OR of two boolean expressions. The semantics of strict AND and OR operators, which would evaluate both expressions before applying the operator, are rarely needed and can easily be obtained using the
Generated April 12, 2004
Last Modified May 25, 2000
Comments to John Reppy.
This document may be distributed freely over the internet as long as the copyright notice and license terms below are prominently displayed within every machine-readable copy.
Copyright © 2004 AT&T and Lucent Technologies. All rights reserved.
Permission is granted for internet users to make one paper copy for their
own personal use. Further hardcopy reproduction is strictly prohibited.
Permission to distribute the HTML document electronically on any medium
other than the internet must be requested from the copyright holders by
contacting the editors.
Printed versions of the SML Basis Manual are available from Cambridge
To order, please visit
www.cup.org (North America) or
www.cup.cam.ac.uk (outside North America).