Functional C (International Computer Science Series) 1st Edition by P. Hartel (PDF)

6

 

Ebook Info

  • Published: 2014
  • Number of pages: 456 pages
  • Format: PDF
  • File Size: 1.51 MB
  • Authors: P. Hartel

Description

Functional C teaches how to program in C, assuming that the student has already learnt how to formulate algorithms in a functional style. By using this as a starting point, the student will become a better C programmer, capable of writing programs that are easier to comprehend, maintain and that avoid common errors and pitfalls. All program code that appears in Functional C is available on our ftp server – see below. How to find a code fragment? To access a particular code fragment, use the book to locate the section or subsection in which the code fragment appears, then click on that section in the code index . This will open the appropriate page at the beginning of the section. The code fragment may then be selected using the copy/paste facilities of your browser. Each chapter is represented by a separate page, so as an alternative to the procedure above you can use the save-as menu of your browser to up-load all code fragments in a particular chapter at once. Also available on our ftp server is errata for Functional C.

User’s Reviews

Editorial Reviews: From the Inside Flap The Computer Science Departments of many universities teach a functional language as the first programming language. Using a functional language with its high level of abstraction helps to emphasize the principles of programming. Functional programming is only one of the paradigms with which a student should be acquainted. Imperative, Concurrent, Object-Oriented, and Logic programming are also important. Depending on the problem to be solved, one of the paradigms will be chosen as the most natural paradigm for that problem.This book is the course material to teach a second paradigm: imperative programming, using C as the programming language. The book has been written so that it builds on the knowledge that the students have acquired during their first course on functional programming, using SML. The prerequisite of this book is that the principles of programming are already understood; this book does not specifically aim to teach Iproblem solvingI or IprogrammingI. This book aims to:Familiarise the reader with em imperative programming as another wayof implementing programs. The aim is to preserve the programmingstyle, that is, the programmer thinks functionally while implementing animperative program.Provide understanding of the differences between functional andimperative programming . Functional programming is a high levelactivity. The ordering of computations and the allocation of storageare automatic. Imperative programming, particularly in C, is a low levelactivity where the programmer controls both the ordering ofcomputations and the allocation of storage. This makes imperativeprogramming more difficult, but it offers the imperative programmeropportunities for optimisations that are not available to thefunctional programmer.Familiarise the reader with the syntax and semantics of ISO-C,especially the power of the language (at the same time stressingthat power can kill). We visit all dark alleys of C, from void *to pointer arithmetic and assignments in expressions.On occasions, we use other languages(like C++ and Pascal) to illustrate concepts of imperative languagesthat are not present in C. C has been chosen because it is a de factostandard for imperative programming, and because its low levelnature nicely contrasts with SML. Those who want to learn, forexample, Modula-2 or Ada-95afterwards should not find many difficulties.Reinforce the principles of programming and problemsolving. This is facilitated by theuse of three different languages (mathematics, a functionallanguage, and an imperative language). The fact that these widelydiffering languages have common aspects makes the idea thatprogramming principles exist and that they are useful quitenatural.Reinforce the principle of abstraction. Throughout the bookwe encourage the student to look for more abstract solutions, forexample, by viewing the signature of a function as an abstraction ofits purpose, by using procedural abstractions (in particular higherorder functions) early on, and by using data abstraction.Guide the student from specification and mathematics toimplementation and software engineering.In the first chapters the emphasis is onwriting correct functions and as we make progress the emphasisgradually shifts to transforming correct functions into efficientand reusable functions. Clean interfaces are of paramountimportance, and are sacrificed for better efficiencyonly as a last resort. Each problem in this book is solved in three steps:A specification of the problem is made.An appropriate algorithm is found to deliver solutions thatsatisfy the specification.The algorithm is implemented as efficiently as possible. Throughoutthe book, the emphasis is on this third step. The language of mathematics is used to specify the problems. This includes the basics of set theory and logic. The student should have some familiarity with the calculi of sets, predicate logic, and propositional logic. This material is taught at most universities during a first course on discrete mathematics or formal logic. The appropriate algorithm is given in SML. SML is freely available for a range of platforms (PC’s, UNIX work stations, Apple), and is therefore popular as a teaching language. As many functional languages are not too different from SML, an appendix gives a brief review of SML for those familiar with any of the other main stream functional languages, such as Miranda, Haskell, Clean, or Scheme.As the target language to implement solutions in an imperative style we have chosen C. The choice to use C and not C++ was a difficult one. Both languages are mainstream languages, and would therefore be suitable as the target language. We have chosen C because it more clearly exposes the low level programming. To illustrate this consider the mechanisms that the languages provide for call by reference. In C, arguments must be explicitly passed as a pointer. The caller must pass the address, the callee must dereference the pointer. This in contrast with the call by reference mechanism of C++ (and Pascal and Modula-2). This explicit call by reference is a didactical asset as it clearly exposes the model behind call by reference, and its dangers (in the form of unwanted aliases).As this book is intended to be used in a first year course, only few assumptions were made about prior knowledge of the students. Reasoning about the correctness of programs requires proof skills, which students might not have acquired at this stage. Therefore we have confined all proofs to specially marked exercises. To distinguish the programming exercises from the exercises requiring a proof, we have marked the latter with an asterisk. We are confident that the book can be used without making a single proof. However we would recommend the students to go through the proofs on a second reading. The answers to one third of the exercises are provided in Appendix A. The student should have an understanding of the basic principles of computing. This would include base 2 arithmetic and the principles of operation of the von Neumann machine. A computer appreciation course would be most appropriate to cover this material. The book contains examples from other areas of computer science, including data bases, computer graphics, the theory of programming languages, and computer architecture. These examples can be understood without prior knowledge of these areas. 0201419505P04062001 From the Back Cover Functional C teaches how to program in C, assuming that the student has already learnt how to formulate algorithms in a functional style. By using this as a starting point, the student will become a better C programmer, capable of writing programs that are easier to comprehend, maintain and that avoid common errors and pitfalls. Features: provides a deep understanding of the differences between functional and imperative programming problem solving techniques used throughout with a wealth of examples and exercises uses elementary program transformation techniques to convert rigorous functional designs into efficient imperative code extensive coverage of all the important features of ANSI-C All program code that appears in Functional C is available via ftp – see below. How to find a code fragment? To access a particular code fragment, use the book to locate the section or subsection in which the code fragment appears, then click on that section in the code index. This will open the appropriate page at the beginning of the section. The code fragment may then be selected using the copy/paste facilities of your browser. Each chapter is represented by a separate page, so as an alternative to the procedure above you can use the save-as menu of your browser to up-load all code fragments in a particular chapter at once. 0201419505B04062001 About the Author Pieter Hartel is a Senior Lecturer at the University of Southampton and at the University of Amsterdam.Henk Muller is a Lecturer at the University of Bristol. 0201419505AB04062001 Excerpt. © Reprinted by permission. All rights reserved. The Computer Science Departments of many universities teach a functional language as the first programming language. Using a functional language with its high level of abstraction helps to emphasize the principles of programming. Functional programming is only one of the paradigms with which a student should be acquainted. Imperative, Concurrent, Object-Oriented, and Logic programming are also important. Depending on the problem to be solved, one of the paradigms will be chosen as the most natural paradigm for that problem.This book is the course material to teach a second paradigm: imperative programming, using C as the programming language. The book has been written so that it builds on the knowledge that the students have acquired during their first course on functional programming, using SML. The prerequisite of this book is that the principles of programming are already understood; this book does not specifically aim to teach Iproblem solvingI or IprogrammingI. This book aims to:Familiarise the reader with em imperative programming as another way of implementing programs. The aim is to preserve the programming style, that is, the programmer thinks functionally while implementing an imperative program.Provide understanding of the differences between functional and imperative programming . Functional programming is a high level activity. The ordering of computations and the allocation of storage are automatic. Imperative programming, particularly in C, is a low level activity where the programmer controls both the ordering of computations and the allocation of storage. This makes imperative programming more difficult, but it offers the imperative programmer opportunities for optimisations that are not available to the functional programmer.Familiarise the reader with the syntax and semantics of ISO-C, especially the power of the language (at the same time stressing that power can kill). We visit all dark alleys of C, from void * to pointer arithmetic and assignments in expressions. On occasions, we use other languages (like C++ and Pascal) to illustrate concepts of imperative languages that are not present in C. C has been chosen because it is a de facto standard for imperative programming, and because its low level nature nicely contrasts with SML. Those who want to learn, for example, Modula-2 or Ada-95 afterwards should not find many difficulties.Reinforce the principles of programming and problem solving. This is facilitated by the use of three different languages (mathematics, a functional language, and an imperative language). The fact that these widely differing languages have common aspects makes the idea that programming principles exist and that they are useful quite natural.Reinforce the principle of abstraction. Throughout the book we encourage the student to look for more abstract solutions, for example, by viewing the signature of a function as an abstraction of its purpose, by using procedural abstractions (in particular higher order functions) early on, and by using data abstraction.Guide the student from specification and mathematics to implementation and software engineering. In the first chapters the emphasis is on writing correct functions and as we make progress the emphasis gradually shifts to transforming correct functions into efficient and reusable functions. Clean interfaces are of paramount importance, and are sacrificed for better efficiency only as a last resort. Each problem in this book is solved in three steps: A specification of the problem is made. An appropriate algorithm is found to deliver solutions that satisfy the specification. The algorithm is implemented as efficiently as possible. Throughout the book, the emphasis is on this third step. The language of mathematics is used to specify the problems. This includes the basics of set theory and logic. The student should have some familiarity with the calculi of sets, predicate logic, and propositional logic. This material is taught at most universities during a first course on discrete mathematics or formal logic. The appropriate algorithm is given in SML. SML is freely available for a range of platforms (PC’s, UNIX work stations, Apple), and is therefore popular as a teaching language. As many functional languages are not too different from SML, an appendix gives a brief review of SML for those familiar with any of the other main stream functional languages, such as Miranda, Haskell, Clean, or Scheme.As the target language to implement solutions in an imperative style we have chosen C. The choice to use C and not C++ was a difficult one. Both languages are mainstream languages, and would therefore be suitable as the target language. We have chosen C because it more clearly exposes the low level programming. To illustrate this consider the mechanisms that the languages provide for call by reference. In C, arguments must be explicitly passed as a pointer. The caller must pass the address, the callee must dereference the pointer. This in contrast with the call by reference mechanism of C++ (and Pascal and Modula-2). This explicit call by reference is a didactical asset as it clearly exposes the model behind call by reference, and its dangers (in the form of unwanted aliases).As this book is intended to be used in a first year course, only few assumptions were made about prior knowledge of the students. Reasoning about the correctness of programs requires proof skills, which students might not have acquired at this stage. Therefore we have confined all proofs to specially marked exercises. To distinguish the programming exercises from the exercises requiring a proof, we have marked the latter with an asterisk. We are confident that the book can be used without making a single proof. However we would recommend the students to go through the proofs on a second reading. The answers to one third of the exercises are provided in Appendix A. The student should have an understanding of the basic principles of computing. This would include base 2 arithmetic and the principles of operation of the von Neumann machine. A computer appreciation course would be most appropriate to cover this material. The book contains examples from other areas of computer science, including data bases, computer graphics, the theory of programming languages, and computer architecture. These examples can be understood without prior knowledge of these areas. 0201419505P04062001 Excerpt. © Reprinted by permission. All rights reserved. The Computer Science Departments of many universities teach a functional language as the first programming language. Using a functional language with its high level of abstraction helps to emphasize the principles of programming. Functional programming is only one of the paradigms with which a student should be acquainted. Imperative, Concurrent, Object-Oriented, and Logic programming are also important. Depending on the problem to be solved, one of the paradigms will be chosen as the most natural paradigm for that problem.This book is the course material to teach a second paradigm: imperative programming, using C as the programming language. The book has been written so that it builds on the knowledge that the students have acquired during their first course on functional programming, using SML. The prerequisite of this book is that the principles of programming are already understood; this book does not specifically aim to teach Iproblem solvingI or IprogrammingI. This book aims to:Familiarise the reader with em imperative programming as another way of implementing programs. The aim is to preserve the programming style, that is, the programmer thinks functionally while implementing an imperative program.Provide understanding of the differences between functional and imperative programming . Functional programming is a high level activity. The ordering of computations and the allocation of storage are automatic. Imperative programming, particularly in C, is a low level activity where the programmer controls both the ordering of computations and the allocation of storage. This makes imperative programming more difficult, but it offers the imperative programmer opportunities for optimisations that are not available to the functional programmer.Familiarise the reader with the syntax and semantics of ISO-C, especially the power of the language (at the same time stressing that power can kill). We visit all dark alleys of C, from void * to pointer arithmetic and assignments in expressions. On occasions, we use other languages (like C++ and Pascal) to illustrate concepts of imperative languages that are not present in C. C has been chosen because it is a de facto standard for imperative programming, and because its low level nature nicely contrasts with SML. Those who want to learn, for example, Modula-2 or Ada-95 afterwards should not find many difficulties.Reinforce the principles of programming and problem solving. This is facilitated by the use of three different languages (mathematics, a functional language, and an imperative language). The fact that these widely differing languages have common aspects makes the idea that programming principles exist and that they are useful quite natural.Reinforce the principle of abstraction. Throughout the book we encourage the student to look for more abstract solutions, for example, by viewing the signature of a function as an abstraction of its purpose, by using procedural abstractions (in particular higher order functions) early on, and by using data abstraction.Guide the student from specification and mathematics to implementation and software engineering. In the first chapters the emphasis is on writing correct functions and as we make progress the emphasis gradually shifts to transforming correct functions into efficient and reusable functions. Clean interfaces are of paramount importance, and are sacrificed for better efficiency only as a last resort. Each problem in this book is solved in three steps: A specification of the problem is made. An appropriate algorithm is found to deliver solutions that satisfy the specification. The algorithm is implemented as efficiently as possible. Throughout the book, the emphasis is on this third step. The language of mathematics is used to specify the problems. This includes the basics of set theory and logic. The student should have some familiarity with the calculi of sets, predicate logic, and propositional logic. This material is taught at most universities during a first course on discrete mathematics or formal logic. The appropriate algorithm is given in SML. SML is freely available for a range of platforms (PC’s, UNIX work stations, Apple), and is therefore popular as a teaching language. As many functional languages are not too different from SML, an appendix gives a brief review of SML for those familiar with any of the other main stream functional languages, such as Miranda, Haskell, Clean, or Scheme.As the target language to implement solutions in an imperative style we have chosen C. The choice to use C and not C++ was a difficult one. Both languages are mainstream languages, and would therefore be suitable as the target language. We have chosen C because it more clearly exposes the low level programming. To illustrate this consider the mechanisms that the languages provide for call by reference. In C, arguments must be explicitly passed as a pointer. The caller must pass the address, the callee must dereference the pointer. This in contrast with the call by reference mechanism of C++ (and Pascal and Modula-2). This explicit call by reference is a didactical asset as it clearly exposes the model behind call by reference, and its dangers (in the form of unwanted aliases).As this book is intended to be used in a first year course, only few assumptions were made about prior knowledge of the students. Reasoning about the correctness of programs requires proof skills, which students might not have acquired at this stage. Therefore we have confined all proofs to specially marked exercises. To distinguish the programming exercises from the exercises requiring a proof, we have marked the latter with an asterisk. We are confident that the book can be used without making a single proof. However we would recommend the students to go through the proofs on a second reading. The answers to one third of the exercises are provided in Appendix A. The student should have an understanding of the basic principles of computing. This would include base 2 arithmetic and the principles of operation of the von Neumann machine. A computer appreciation course would be most appropriate to cover this material. The book contains examples from other areas of computer science, including data bases, computer graphics, the theory of programming languages, and computer architecture. These examples can be understood without prior knowledge of these areas. 0201419505P04062001 Read more

Reviews from Amazon users which were colected at the time this book was published on the website:

⭐I’m an experienced C programmer, and a fan of Haskell. This thorough but concise textbook gave me a new way of looking at C, and showed me both its problems and strengths. It advertises itself as a textbook for first-year college students, so you’re unlikely to learn any new features of C from reading this, but, like me, you may learn an entirely new way of understanding the language.

Keywords

Free Download Functional C (International Computer Science Series) 1st Edition in PDF format
Functional C (International Computer Science Series) 1st Edition PDF Free Download
Download Functional C (International Computer Science Series) 1st Edition 2014 PDF Free
Functional C (International Computer Science Series) 1st Edition 2014 PDF Free Download
Download Functional C (International Computer Science Series) 1st Edition PDF
Free Download Ebook Functional C (International Computer Science Series) 1st Edition

Previous articleProgramming Languages: Implementations, Logics, and Programs: 9th International Symposium, PLILP ’97, Including a Special Track on Declarative … (Lecture Notes in Computer Science, 1292) 1997th Edition by Hugh Glaser (PDF)
Next articlePrinciples of Declarative Programming: 10th International Symposium PLILP’98, Held Jointly with the 6th International Conference ALP’98, Pisa, Italy, September 16-18, 1998 Proceedings (Lecture Notes in Computer Science, 1490) by Catuscia Palamidessi (PDF)