Skip to main content Accessibility help
×
Hostname: page-component-586b7cd67f-vdxz6 Total loading time: 0 Render date: 2024-11-20T07:16:29.337Z Has data issue: false hasContentIssue false

1 - Introduction

Published online by Cambridge University Press:  12 October 2009

Flemming Nielson
Affiliation:
Aarhus Universitet, Denmark
Hanne Riis Nielson
Affiliation:
Aarhus Universitet, Denmark
Get access

Summary

The functional programming style is closely related to the use of higher-order functions. In particular, it suggests that many function definitions are instances of the same general computational pattern and that this pattern is defined by a higher-order function. The various instances of the pattern are then obtained by supplying the higher-order function with some of its arguments.

One of the benefits of this programming style is the reuse of function definitions and, more importantly, the reuse of properties proved to hold for them: usually a property of a higher-order function carries over to an instance by verifying that the arguments satisfy some simple properties.

One of the disadvantages is that the efficiency is often rather poor. The reason is that when generating code for a higher-order function it is impossible to make any assumptions about its arguments and to optimize the code accordingly. Furthermore, conventional machine architectures make it rather costly to use functions as data.

We shall therefore be interested in transforming instances of higher-order functions into functions that can be implemented more efficiently. The key observation in the approach to be presented here is that an instance of a higher-order function is a function where some of the arguments are known and others are not. To be able to exploit this we shall introduce an explicit distinction between known and unknown values or, using traditional compiler terminology, between compile-time entities and run-time entities.

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

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.

  • Introduction
  • Flemming Nielson, Aarhus Universitet, Denmark, Hanne Riis Nielson, Aarhus Universitet, Denmark
  • Book: Two-Level Functional Languages
  • Online publication: 12 October 2009
  • Chapter DOI: https://doi.org/10.1017/CBO9780511526572.002
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.

  • Introduction
  • Flemming Nielson, Aarhus Universitet, Denmark, Hanne Riis Nielson, Aarhus Universitet, Denmark
  • Book: Two-Level Functional Languages
  • Online publication: 12 October 2009
  • Chapter DOI: https://doi.org/10.1017/CBO9780511526572.002
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.

  • Introduction
  • Flemming Nielson, Aarhus Universitet, Denmark, Hanne Riis Nielson, Aarhus Universitet, Denmark
  • Book: Two-Level Functional Languages
  • Online publication: 12 October 2009
  • Chapter DOI: https://doi.org/10.1017/CBO9780511526572.002
Available formats
×