10.07.2015 Views

An Introduction to Functional Programming Through Lambda Calculus

An Introduction to Functional Programming Through Lambda Calculus

An Introduction to Functional Programming Through Lambda Calculus

SHOW MORE
SHOW LESS

You also want an ePaper? Increase the reach of your titles

YUMPU automatically turns print PDFs into web optimized ePapers that Google loves.

- 164 -opWe will look at this in more detail when we consider standard functions.9.7. Boolean standard functionsThe boolean negation function:notreturns the negation of its boolean argument, for example:- not true;> false : boolThus, not’s type is:- not;> fn : bool -> boolConjunction and disjunction are provided through the sequential infix opera<strong>to</strong>rs:andalso orelsein the derived syntax, for example:- true orelse false;> true : bool- true andalso false;> false : boolSML systems may not be able <strong>to</strong> display these opera<strong>to</strong>rs’ types but they are effectively:fn : (bool * bool) -> boolas they both take two boolean arguments, which are treated as a:bool * booltuple for infix syntax, and return a boolean result.9.8. Numeric standard functions and opera<strong>to</strong>r overloadingSML provides real numbers as well as integers. However, as in many other languages, the same opera<strong>to</strong>rs are used forboth even though they are distinct types. This use of the same opera<strong>to</strong>r with different types is known as opera<strong>to</strong>roverloading.The addition, subtraction and multiplication infix opera<strong>to</strong>rs are:+ - *SML systems may not display their types because they are overloaded. SML literature uses the invented type:num

Hooray! Your file is uploaded and ready to be published.

Saved successfully!

Ooh no, something went wrong!