From c66c2e02adcdd890b11aa3841fcbe2f0e26b304b Mon Sep 17 00:00:00 2001 From: Nicolas Lenz <nicolas@eisfunke.com> Date: Sat, 9 Jul 2022 17:40:01 +0200 Subject: [PATCH] Move chapters --- src/00-introduction.md | 24 +----- src/01-motivation.md | 78 +++++++++++++++++++ ...rst-functions.md => 03-first-functions.md} | 0 src/03-what-is-functional-programming.md | 29 ------- src/{05-first-types.md => 04-first-types.md} | 0 src/{06-first-logic.md => 05-first-logic.md} | 0 ...ntation.md => 06-finding-documentation.md} | 0 ...8-first-modules.md => 07-first-modules.md} | 0 src/{09-simple-io.md => 08-simple-io.md} | 0 ...{10-higher-order.md => 09-higher-order.md} | 0 src/{11-types.md => 10-types.md} | 0 ...more-functions.md => 11-more-functions.md} | 0 src/{13-typeclasses.md => 12-typeclasses.md} | 0 src/{14-functors.md => 13-functors.md} | 0 src/{15-monads.md => 14-monads.md} | 0 ...management.md => 15-project-management.md} | 0 template | 2 +- 17 files changed, 81 insertions(+), 52 deletions(-) rename src/{04-first-functions.md => 03-first-functions.md} (100%) delete mode 100644 src/03-what-is-functional-programming.md rename src/{05-first-types.md => 04-first-types.md} (100%) rename src/{06-first-logic.md => 05-first-logic.md} (100%) rename src/{07-finding-documentation.md => 06-finding-documentation.md} (100%) rename src/{08-first-modules.md => 07-first-modules.md} (100%) rename src/{09-simple-io.md => 08-simple-io.md} (100%) rename src/{10-higher-order.md => 09-higher-order.md} (100%) rename src/{11-types.md => 10-types.md} (100%) rename src/{12-more-functions.md => 11-more-functions.md} (100%) rename src/{13-typeclasses.md => 12-typeclasses.md} (100%) rename src/{14-functors.md => 13-functors.md} (100%) rename src/{15-monads.md => 14-monads.md} (100%) rename src/{16-project-management.md => 15-project-management.md} (100%) diff --git a/src/00-introduction.md b/src/00-introduction.md index 1cfe4cc..3c8ff01 100644 --- a/src/00-introduction.md +++ b/src/00-introduction.md @@ -14,12 +14,12 @@ Nicolas Lenz ## Contact & Links **Mail:** \ -[nicolas.lenz@udo.edu](mailto:nicolas.lenz@udo.edu) +[nicolas@eisfunke.com](mailto:nicolas@eisfunke.com) **Homepage** (with more contact data and links to projects): \ [eisfunke.com](https://www.eisfunke.com) -**My GitLab instance** (with some Haskell stuff): \ +**My GitLab** (with my projects, including Haskell stuff): \ [git.eisfunke.com](https://git.eisfunke.com) ## Interaction & Questions @@ -39,23 +39,3 @@ Very good, fun to read, free to read online and base for this workshop: \centering  - -## Haskell - -We'll be using [Haskell](https://www.haskell.org/). - - - -- Since 1990 -- Purely functional -- Statically & strongly typed -- Used in academic context - -## Other Functional Languages - -- Scala -- Lisp -- Scheme -- F# -- [Lightfold](https://git.eisfunke.com/software/lightfold/lightfold) -- Many others in varying degrees diff --git a/src/01-motivation.md b/src/01-motivation.md index 6d76933..ec2c725 100644 --- a/src/01-motivation.md +++ b/src/01-motivation.md @@ -1 +1,79 @@ # Motivation + +## Motivation + +::: important +Why learn functional programming? +::: + +## What is Functional Programming? + +- To answer that question, we have to first find out what functional programming even is + +## Imperative + +- *Imperative* vs. *Functional* +- Programming lanuages like Java or C are **imperative** +- Program = sequence of commands to be executed one after another + +``` +x = 2 +doThing(x) +x = 4 +doThing(x) +``` + +Works without problem. + +## Functional + +- Different approach +- In **functional** programming a program is **not** a list of commands +- Program = *collection of definitions* + +```haskell +x = 2 +x = 4 +``` + +Will *this* work? + +## Advantages + +TODO side effects + +TODO global state + +TODO higher-order functions (map, filter, etc. fold) + +- https://kotlinlang.org/docs/lambdas.html#higher-order-functions +- https://linqexamples.com/filtering/where.html +- https://www.w3schools.com/python/python_lambda.asp +- https://docs.microsoft.com/en-us/dotnet/csharp/language-reference/operators/lambda-expressions +- https://attacomsian.com/blog/java-filter-map + +TODO brevity (quicksort) + +TODO easer to reason about + +## Functional Languages + +There are many mainly functional programming languages: + +- Scala +- Lisp +- Scheme +- F# +- [Lightfold](https://git.eisfunke.com/software/lightfold/lightfold) +- Many others in varying degrees + +## Haskell + +However, we'll be using [Haskell](https://www.haskell.org/). + + + +- Since 1990 +- Purely functional +- Statically & strongly typed +- Used in academic context diff --git a/src/04-first-functions.md b/src/03-first-functions.md similarity index 100% rename from src/04-first-functions.md rename to src/03-first-functions.md diff --git a/src/03-what-is-functional-programming.md b/src/03-what-is-functional-programming.md deleted file mode 100644 index 795ab7a..0000000 --- a/src/03-what-is-functional-programming.md +++ /dev/null @@ -1,29 +0,0 @@ -# What is Functional Programming? - -## The Difference - -- *Imperative* vs. *Functional* -- Programming lanuages like Java or C are **imperative** -- Program = sequence of commands to be executed one after another - -``` -x = 2 -doThing(x) -x = 4 -doThing(x) -``` - -Works without problem. - -## Functional - -- Different approach -- In **functional** programming a program is **not** a list of commands -- Program = *collection of definitions* - -```haskell -x = 2 -x = 4 -``` - -Will *this* work? diff --git a/src/05-first-types.md b/src/04-first-types.md similarity index 100% rename from src/05-first-types.md rename to src/04-first-types.md diff --git a/src/06-first-logic.md b/src/05-first-logic.md similarity index 100% rename from src/06-first-logic.md rename to src/05-first-logic.md diff --git a/src/07-finding-documentation.md b/src/06-finding-documentation.md similarity index 100% rename from src/07-finding-documentation.md rename to src/06-finding-documentation.md diff --git a/src/08-first-modules.md b/src/07-first-modules.md similarity index 100% rename from src/08-first-modules.md rename to src/07-first-modules.md diff --git a/src/09-simple-io.md b/src/08-simple-io.md similarity index 100% rename from src/09-simple-io.md rename to src/08-simple-io.md diff --git a/src/10-higher-order.md b/src/09-higher-order.md similarity index 100% rename from src/10-higher-order.md rename to src/09-higher-order.md diff --git a/src/11-types.md b/src/10-types.md similarity index 100% rename from src/11-types.md rename to src/10-types.md diff --git a/src/12-more-functions.md b/src/11-more-functions.md similarity index 100% rename from src/12-more-functions.md rename to src/11-more-functions.md diff --git a/src/13-typeclasses.md b/src/12-typeclasses.md similarity index 100% rename from src/13-typeclasses.md rename to src/12-typeclasses.md diff --git a/src/14-functors.md b/src/13-functors.md similarity index 100% rename from src/14-functors.md rename to src/13-functors.md diff --git a/src/15-monads.md b/src/14-monads.md similarity index 100% rename from src/15-monads.md rename to src/14-monads.md diff --git a/src/16-project-management.md b/src/15-project-management.md similarity index 100% rename from src/16-project-management.md rename to src/15-project-management.md diff --git a/template b/template index 4a8f277..f512fca 160000 --- a/template +++ b/template @@ -1 +1 @@ -Subproject commit 4a8f277ee2ba6ac30d23cfb3c35b874a8bc612f9 +Subproject commit f512fcaeec86489fb583ff5cbebf52539778cd28 -- GitLab