Chapter 1 Introduction
“A language that doesn’t affect the way you think about programming, is not worth knowing. ” A. Perlis
“If you want to see which features will be in mainstream programming languages tomorrow, then take a look at functional programming lan- guages today.”
“Languages like [..] OCaml have served as a laboratory for new ideas to be developed, some of which have then made the transition into the mainstream.”
Copyright By PowCoder代写 加微信 powcoder
Functional programming has been one of the earliest programming paradigms to emerge. The tradition of thinking of programs as functions goes back to in the 1930s when mathematicians aimed to understand questions such as what is computable and how can we compute a given result. pro- posed a computational model that was based on mathematical functions. Building on these ideas, Lisp emerged in the 1960s as one of the earliest implemented func- tional languages where the primary vehicle of computation are defining, applying, and composing functions. It still plays an important role today.
Functional programs often shines due to its beauty and the ability to express com- pactly and elegantly computational ideas. But the crucial ideas functional program- ming introduces to programming in general can be found in many other languages today.
For example, once central aspect in functional programming is that functions are first-class citizens. This means functions (programs!) themselves be viewed as data. Hence they can be passed as argument, and returned as results. This powerful idea
7 c B. Pientka – Fall 2020
Chapter 1: Introduction
lies at the heart of writing reusable and modular code. To make this more concrete, consider the following scenario: we want to transform each entry in a list by con- verting it to another format – let’s say from integers to floating point representations or we might want to turn the integers into a string to print them. More generally, we want to apply a given operation to each element in a list or a row in a spreadsheet or database. This is an important computational idea that is also at the core at how we manipulate and transform matrices and large data sets in general. As we will see, this idea can be easily understood and expressed in functional programming where we can write functions that take other functions as arguments!
The idea of polymorphic data representations and functions is a key idea of gener- ically representing data and computation. This allows us to implement traversals through generic data stuctures such as lists or binary trees no matter what concrete data we may actually store in these lists or trees. Hence, functionality is implemented in one place and programs are easier to maintain and are less error prone. The idea of polymorphism goes back to and Girard’s work the 1970s and found quickly its way into typed functional languages such as OCaml or Haskell. It also eventually found its way into object-oriented languages such as Java and Scala in 2004.
These two examples illustrate well how functional programming has been a trail- blazer into introducing computational ideas that are now also supported in many other existing languages.
Over the past decade, functional programming has not only become cool, but it also has gained more and more influence in practice.
This course is about learning a new programming paradigm, functional program- ming, and providing a new perspective on fundamental concepts that are common in many programming languages. Through the lense of functional programming we are understanding better different programming paradigms and how languages are designed and implemented. This course has four main goals.
1. Provide a thorough introduction to fundamental concepts in programming lan- guages
We are exploring many important concepts that you will find also in scripting, imperative, and object-oriented languages. Once you understand them, you will recognize them in many languages, although they might be disguised.
Higher-order functions, State-full vs state-free computation, Modelling objects and clo- sures, Exceptions to defer control, Continuations to defer control, Polymorphism, Par- tial evaluation, Lazy programming, Modules, . . .
8 c B. Pientka – Fall 2020
Chapter 1: Introduction
2. Show different ways to reason about programs
Writing reliable software is important; to understand how to reason about your programs will make you a better programmer overall no matter what language you will be using.
Type checking, Induction, Operational semantics, QuickCheck, . . .
3. Introduce fundamental principles in programming language design
To gain a deeper understanding of how programming languages work, we give an introduction to how to define programming languages are defined. We look at some of the most beautiful and intrigueing ideas: type inference in statically typed functional programming languages.
Grammars and parsing, Operational semantics and interpreters, Type checking, poly- morphism, and subtyping
4. Expose students to a different way of thinking about problems
It’s about broadening and stretching once mind and this course is guaranteed to profoundly change how you think about programming. Once you get drawn into functional programming it is also a lot of fun!
9 c B. Pientka – Fall 2020
程序代写 CS代考 加微信: powcoder QQ: 1823890830 Email: powcoder@163.com