Functional Programming


E-Book Content

Functional Programming ii c Copyright 1992–1995 Jeroen Fokker and Department of Computer Science, Utrecht University This text may be reproduced for educational purposes under the following restrictions: • the text will not be edited or truncated; • especially this message will be reproduced too; • the duplicates will not be sold for profits; You can reach the author at: Jeroen Fokker, Vakgroep Informatica, Postbus 80089, 3508 TB Utrecht, e-mail [email protected] Dutch edition: 1st print September 1992 2nd print February 1993 3rd reviewed print September 1993 4th reviewed print September 1994 5th reviewed print September 1995 Spanish edition, translated by Hielko Ophoff: based on 4th reviewed print September 1994 English edition, translated by Dennis Gruijs and Arjan van IJzendoorn: based on 5th reviewed print September 1995 iii Contents 1 Functional Programming 1 1.1 Functional Languages 1 1.1.1 Functions 1 1.1.2 Languages 1 1.2 The Gofer-interpreter 2 1.2.1 Evaluating expressions 2 1.2.2 Defining functions 4 1.2.3 Internal commands 5 1.3 Standard functions 5 1.3.1 Primitive/predefined 5 1.3.2 Names of functions and operators 6 1.3.3 Functions on numbers 7 1.3.4 Boolean functions 8 1.3.5 Functions on lists 8 1.3.6 Functions on functions 9 1.4 Function definitions 9 1.4.1 Definition by combination 9 1.4.2 Definition by case distinction 10 1.4.3 Definition by pattern matching 11 1.4.4 Definition by recursion or induction 12 1.4.5 Layout and comments 13 1.5 Typing 14 1.5.1 Kinds of errors 14 1.5.2 Prototyping of expressions 15 1.5.3 Polymorphism 16 1.5.4 Functions with more parameters 17 1.5.5 Overloading 17 Exercises 18 2 Numbers and functions 21 2.1 Operators 21 2.1.1 Operators as functions and vice versa 21 2.1.2 Priorities 2
You might also like

From Gestalt Theory To Image Analysis: A Probabilistic Approach
Authors: Agnés Desolneux , Lionel Moisan , Jean-Michel Morel (auth.)    139    0


Pattern Classification
Authors: Richard O. Duda , Peter E. Hart , David G. Stork    156    0


Advances In Discrete Tomography And Its Applications
Authors: Gabor T. Herman , Attila Kuba    116    0


3d Structure From Images — Smile 2000: Second European Workshop On 3d Structure From Multiple Images Of Large-scale Environments Dublin, Irleand, July 1–2, 2000 Revised Papers
Authors: Paul Debevec (auth.) , Marc Pollefeys , Luc Van Gool , Andrew Zisserman , Andrew Fitzgibbon (eds.)    146    0


Algorithms
Authors: Sanjoy Dasgupta , Christos Papadimitriou , Umesh Vazirani    186    0


Beginning Python
Authors: Peter C. Norton , Alex Samuel , Dave Aitel , Eric Foster-Johnson , Leonard Richardson , Jason Diamond , Aleatha Parker , Michael Roberts    197    0


Object-oriented Programming Via Fortran 90-95
Authors: Ed Akin    147    0


Algorithms For Computational Linguistics
Authors: Striegnitz K. , et al.    186    0


Linear Programming: Theory And Extensions
Authors: George B. Dantzig , Mukund N. Thapa    186    0


Linear Programming: Foundations And Extensions
Authors: Robert Vanderbei    133    0