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

Tree Automata Techniques And Applications
Authors: Comon H. , et al.    141    0


Perl Programming For Biologists
Authors: D. Curtis Jamison    81    0


Bioinformatics, Biocomputing And Perl: An Introduction
Authors: Michael Moorhouse , Paul Barry    106    0



Feature Extraction And Image Processing
Authors: Mark Nixon , Alberto S Aguado    120    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.)    107    0


System Theory, The Schur Algorithm And Multidimensional Analysis
Authors: Daniel Alpay , Victor Vinnikov    158    0


Linear Programming And Its Applications
Authors: H.A. Eiselt , C.-L. Sandblom    95    0


An Invariant Approach To Statistical Analysis Of Shapes
Authors: Subhash R. Lele , J. T. Richtsmeier    73    0


Tex By Topic: A Texnician's Reference
Authors: Victor Eijkhout    101    0