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.

- 88 -• considered repetitive type checking, and static and dynamic typing• introduced notation for strictly bracketed infix expressions• introduced notation for case definitions and structure matchingSome of these <strong>to</strong>pics are summarised below.IF ... THEN ... ELSE ...IF THEN ELSE ==COND Infix opera<strong>to</strong>rs == Note that strict bracketing is required for nested infix expressions.Boolean case definitiondef TRUE = or FALSE = ==def =IF THEN ELSE Number case definitionrec 0 = or (SUCC ) = ==rec =IF ISZERO THEN ELSE 5.15. Exercises1) Evaluate fully the following expressions:i) ISBOOL 3ii) ISNUMB FALSEiii) NOT 1iv) TRUE AND 2v) 2 + TRUE2) Signed numbers might be introduced as a new type with an extra layer of ‘pairing’ so that a numbers’s value ispreceded by a boolean <strong>to</strong> indicate whether or not the number is positive or negative:

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

Saved successfully!

Ooh no, something went wrong!