Skip to main content Accessibility help
×
Hostname: page-component-78c5997874-s2hrs Total loading time: 0 Render date: 2024-11-09T14:07:59.202Z Has data issue: false hasContentIssue false

3 - Functional Programming with Haskell

Published online by Cambridge University Press:  05 June 2012

Jan van Eijck
Affiliation:
Centre for Mathematics and Computer Science, Amsterdam
Christina Unger
Affiliation:
Universität Bielefeld, Germany
Get access

Summary

Summary

In this chapter we introduce the computational toolset that we are going to use throughout the book: the programming language Haskell. No prior knowledge of programming is assumed; you will learn everything you need to know about Haskell and (functional) programming as we go along.

The Programming Language Haskell

As a functional programming language, Haskell is a member of the Lisp family, as are Scheme, ML, Occam, Clean, and Erlang. It was designed to form a standard for functional programming languages and was named after the mathematician and logician Haskell B. Curry. We already mentioned that it is based on the lambda calculus, just like the other family members. In fact, Haskell is so faithful to its origins that it is purely functional, i.e. functions in Haskell do not have any side effects. (However, there is a way to perform computations with side effects, like change of state, in a purely functional fashion. We will come across this later on in the book, but it will not be of concern for us now.)

Three very important characteristic features of Haskell are the following. First, functions are first-class citizens. This means that functions may be passed as arguments to other functions and also can be returned as the result of some function. Second, functions are permitted to be recursive. The significance of this we will see in Section 3.5.

Type
Chapter
Information
Publisher: Cambridge University Press
Print publication year: 2010

Access options

Get access to the full version of this content by using one of the access options below. (Log in options will check for institutional or personal access. Content may require purchase if you do not have access.)

Save book to Kindle

To save this book to your Kindle, first ensure [email protected] is added to your Approved Personal Document E-mail List under your Personal Document Settings on the Manage Your Content and Devices page of your Amazon account. Then enter the ‘name’ part of your Kindle email address below. Find out more about saving to your Kindle.

Note you can select to save to either the @free.kindle.com or @kindle.com variations. ‘@free.kindle.com’ emails are free but can only be saved to your device when it is connected to wi-fi. ‘@kindle.com’ emails can be delivered even when you are not connected to wi-fi, but note that service fees apply.

Find out more about the Kindle Personal Document Service.

Available formats
×

Save book to Dropbox

To save content items to your account, please confirm that you agree to abide by our usage policies. If this is the first time you use this feature, you will be asked to authorise Cambridge Core to connect with your account. Find out more about saving content to Dropbox.

Available formats
×

Save book to Google Drive

To save content items to your account, please confirm that you agree to abide by our usage policies. If this is the first time you use this feature, you will be asked to authorise Cambridge Core to connect with your account. Find out more about saving content to Google Drive.

Available formats
×