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

Create successful ePaper yourself

Turn your PDF publications into a flip-book with our unique Google optimized e-Paper software.

- 161 - : For objects which do not have printable value representations SML will still display the types. In particular, functionvalues are displayed as:fn : Types are described by type expressions. We will see how these are constructed as we discuss specific types.9.3. Basic types - booleans, integers and stringsThe type expression for a basic type is the type’s identifier.The boolean type has identifier:booland values:true falseFor example:- true;> true : boolThe integer type has identifier:intwith positive and negative integer values, for example:- 42;> 42 : int- ˜84˜84 : intNote the use of ˜ as the negative sign.The string type has identifier:stringString values are character sequences within- "Is this a string?";> "Is this a string?" : string9.4. ListsIn SML, unlike LISP and our approach <strong>to</strong> λ calculus, a list must contain elements of the same type and end with theempty list. Thus, lists cannot be used <strong>to</strong> represent records with different type fields.Lists are written as , separated element sequences within [ and ]. For example:

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

Saved successfully!

Ooh no, something went wrong!