Difference between revisions of "Practical Functional Programming"
(Created blank page) |
|||
Line 1: | Line 1: | ||
+ | <translate> | ||
+ | == Basic introduction == <!--T:1--> | ||
+ | <!--T:4--> | ||
+ | Functional style of programming is well established, but for decades it was mostly used in universities and frequently it was treated like a nice concept without real practical application. Pure functional languages like Haskell, were rarely used for real life applications. Right now, functional style of programing is going through a sort of renaissance. It is embedded into many of the most popular multiparadigm languages like Python, Javascript or C#. Moreover, with the usage of JVM (Scala) or .NET CLR (F#) it is even easier to have a project accommodating various styles of programming. In this subject, we will focus on practical aspects of applications development using pure functional programming language Haskell (maybe also Elm) and on the application of principles of functional programming in other languages. Beside the programming itself, we will learn how to use some of the key infrastructure and tools supporting the development of real-life applications. | ||
+ | |||
+ | ===Subject aims expressed by acquired skills and competences=== <!--T:5--> | ||
+ | |||
+ | <!--T:6--> | ||
+ | The aim of the course is to show the practical use of purely functional programming languages for the development of real-life applications. As a key project, a web-based information system will be implemented. In addition to pure functional programming languages and the related functional style of programming itself, students will also learn selected tools and a programming environment, that is necessary to build more complex applications. | ||
+ | |||
+ | After completing the course, participants will be able to practically apply a functional style of programming to solve real-life problems. They will be able to evaluate, if it is suitable to use it in given context and what advantages or disadvantages such approach will bring. They will get acquainted in more detail with the programming language Haskell and (probably) Elm (both are syntactically very similar). They will also learn more about the functional style of programming, which can be useful also in other technologies than for purely functional programming languages. Most of today's dominant technologies support many programming paradigms and it is more a choice of the programmer, which style will be used in the solution. The course enables you to use the functional style of programming in many aspects regardless of the used environment. | ||
+ | |||
+ | ===Recommended literature=== <!--T:7--> | ||
+ | *Lipovaca M.:Learn You a Haskell for Great Good!: A Beginner's Guide (1st ed.). No Starch Press, San Francisco, CA, USA, 2011 - for free at: http://learnyouahaskell.com/ | ||
+ | |||
+ | <!--T:8--> | ||
+ | *O'Sullivan B., Goerzen J., Stewart D.: Real world Haskell, O'Reilly Media, Inc. 2008. ISBN:0596514980 - for free at: http://book.realworldhaskell.org/read/ | ||
+ | |||
+ | <!--T:9--> | ||
+ | *Thompson S.: The Haskell: The Craft of Functional Programming (3nd ed.). Addison-Wesley Professional, October 2, 2011, ISBN-10: 0201882957. | ||
+ | |||
+ | ===Way of continuous check of knowledge in the course of semester=== <!--T:10--> | ||
+ | During the exercises, students will be programming assigned tasks. The results of these tasks will be the crucial part of the final evaluation. Additionally, a project we will create a web-based information system, where the front end will be implemented in Elm and the back end will be in Haskell. They will be connected through REST Api. Moreover, we will address other issues as the usage of database or parsing various data formats. | ||
+ | |||
+ | On these tasks, it will be demonstrated, that these functional languages are well suited for the development of real-life applications. | ||
+ | |||
+ | == Software == <!--T:15--> | ||
+ | In our lectures, we will be using [https://www.haskell.org/downloads/#platform Haskell Platform] with [https://code.visualstudio.com/ Visual Studio Code]. For VS Code, we will be using an extension: | ||
+ | *[https://marketplace.visualstudio.com/items?itemName=haskell.haskell Haskell] | ||
+ | |||
+ | <!--T:31--> | ||
+ | More information about various options for work environments can be found: [[FP_installation_guide | Installation Guide]] | ||
+ | |||
+ | == Presentations == <!--T:11--> | ||
+ | </translate> | ||
+ | <span id="presentations"></span> | ||
+ | <translate> | ||
+ | <!--T:12--> | ||
+ | Presentations used in our lectures: | ||
+ | </translate> | ||
+ | |||
+ | [http://linedu.vsb.cz/~beh01/wiki_data/FPR_uvod.pdf Úvod do FPR] [http://linedu.vsb.cz/~beh01/wiki_data/FPR_introduction.pdf Introduction to FPR] | ||
+ | |||
+ | [http://linedu.vsb.cz/~beh01/wiki_data/Zaklady_FP.pdf Základy funkcionálního programování] | ||
+ | *[http://linedu.vsb.cz/~beh01/wiki_data/Basics_of_FP.pdf#page=14 Page 12] [[File:Video logo.png|80px|link=https://youtu.be/641a45ILdkc]] CZ | ||
+ | *[http://linedu.vsb.cz/~beh01/wiki_data/Basics_of_FP.pdf#page=28 Page 26] [[File:Video logo.png|80px|link=https://youtu.be/6eXCGAlI3FM]] CZ | ||
+ | *[http://linedu.vsb.cz/~beh01/wiki_data/Basics_of_FP.pdf#page=36 Page 34] [[File:Video logo.png|80px|link=https://youtu.be/RlQumT3LNfI]] CZ | ||
+ | *[http://linedu.vsb.cz/~beh01/wiki_data/Basics_of_FP.pdf#page=44 Page 42] Lists [[File:Video logo.png|80px|link=https://youtu.be/qJyi7fuICT0]] Tuples [[File:Video logo.png|80px|link=https://youtu.be/axb0WOROuf0]] CZ | ||
+ | *[http://linedu.vsb.cz/~beh01/wiki_data/Basics_of_FP.pdf#page=50 Page 48] Theory [[File:Video logo.png|80px|link=https://youtu.be/XINafdmXTIE]] Example [[File:Video logo.png|80px|link=https://youtu.be/6jawdNysjs8]] CZ | ||
+ | *[http://linedu.vsb.cz/~beh01/wiki_data/Basics_of_FP.pdf#page=57 Page 55] [[File:Video logo.png|80px|link=https://youtu.be/QHtGADjvwCU]] CZ | ||
+ | *[http://linedu.vsb.cz/~beh01/wiki_data/Basics_of_FP.pdf#page=72 Page 70] [[File:Video logo.png|80px|link=https://youtu.be/Tf7tyJbHDuo]] CZ | ||
+ | *[http://linedu.vsb.cz/~beh01/wiki_data/Basics_of_FP.pdf#page=82 Page 80] [[File:Video logo.png|80px|link=https://youtu.be/tOmNZNCWICg]] CZ | ||
+ | |||
+ | [http://linedu.vsb.cz/~beh01/wiki_data/Basics_of_FP.pdf Basics of functional Programming] | ||
+ | *[http://linedu.vsb.cz/~beh01/wiki_data/Basics_of_FP.pdf#page=14 Page 12] [[File:Video logo.png|80px|link=https://youtu.be/ZAR4ZPkTRSI]] EN | ||
+ | *[http://linedu.vsb.cz/~beh01/wiki_data/Basics_of_FP.pdf#page=28 Page 26] [[File:Video logo.png|80px|link=https://youtu.be/se5G4KjvGh8]] EN | ||
+ | *[http://linedu.vsb.cz/~beh01/wiki_data/Basics_of_FP.pdf#page=36 Page 34] [[File:Video logo.png|80px|link=https://youtu.be/jgOIsTomglM]] EN | ||
+ | *[http://linedu.vsb.cz/~beh01/wiki_data/Basics_of_FP.pdf#page=44 Page 42] [[File:Video logo.png|80px|link=https://youtu.be/GeFUKjhz46s]] EN | ||
+ | *[http://linedu.vsb.cz/~beh01/wiki_data/Basics_of_FP.pdf#page=50 Page 48] [[File:Video logo.png|80px|link=https://youtu.be/xKEMJPES9K4]] EN | ||
+ | |||
+ | [http://linedu.vsb.cz/~beh01/wiki_data/Advanced_FP.pdf Introduction to advanced topics of functional programming] | ||
+ | |||
+ | <translate> | ||
+ | <!--T:20--> | ||
+ | Schedule: | ||
+ | </translate> | ||
+ | * Lecture 1: [http://linedu.vsb.cz/~beh01/wiki_data/Basics_of_FP.pdf#page=1 Beginning] - [http://linedu.vsb.cz/~beh01/wiki_data/Basics_of_FP.pdf#page=36 Page 34] (2 hours) | ||
+ | * Lecture 2: [http://linedu.vsb.cz/~beh01/wiki_data/Basics_of_FP.pdf#page=35 Page 35] - [http://linedu.vsb.cz/~beh01/wiki_data/Basics_of_FP.pdf#page=44 Page 42] (2 hours) | ||
+ | * Lecture 3: no lecture | ||
+ | * Lecture 4: [http://linedu.vsb.cz/~beh01/wiki_data/Basics_of_FP.pdf#page=45 Page 43] - [http://linedu.vsb.cz/~beh01/wiki_data/Basics_of_FP.pdf#page=57 Page 55] (2 hour) | ||
+ | * Lecture 5: [http://linedu.vsb.cz/~beh01/wiki_data/Basics_of_FP.pdf#page=58 Page 56] - [http://linedu.vsb.cz/~beh01/wiki_data/Basics_of_FP.pdf#page=65 Page 63] (1 hour) | ||
+ | * Lecture 6: [http://linedu.vsb.cz/~beh01/wiki_data/Basics_of_FP.pdf#page=66 Page 64] - [http://linedu.vsb.cz/~beh01/wiki_data/Basics_of_FP.pdf#page=72 Page 70] (1 hour) | ||
+ | * Lecture 7: Summary before Test 1 | ||
+ | * Lecture 8: no lecture | ||
+ | * Lecture 9: [http://linedu.vsb.cz/~beh01/wiki_data/Basics_of_FP.pdf#page=73 Page 71] - [http://linedu.vsb.cz/~beh01/wiki_data/Basics_of_FP.pdf#page=82 Page 80] (1 hour) + Solutions for Test 1 | ||
+ | * Lecture 10: Solutions for Homework 1 | ||
+ | * Lecture 11: Summary before Test 2 | ||
+ | * Lecture 12: Advanced topics (2 hours) | ||
+ | * Lecture 13: Advanced topics (2 hours) | ||
+ | * Lecture 14: Solutions for Homework 2 + Test 2 | ||
+ | |||
+ | <translate> | ||
+ | |||
+ | == Laboratories == <!--T:13--> | ||
+ | </translate> | ||
+ | {{anchor|laboratories}} | ||
+ | <translate> | ||
+ | <!--T:14--> | ||
+ | * [[FP_Laboratory_1 | Laboratory 1]] | ||
+ | * [[FP_Laboratory_2 | Laboratory 2]] | ||
+ | * [[FP_Laboratory_3 | Laboratory 3]] | ||
+ | * [[FP_Laboratory_4 | Laboratory 4]] | ||
+ | * [[FP_Laboratory_5 | Laboratory 5]] | ||
+ | * [[FP_Laboratory_6 | Laboratory 6]] | ||
+ | * [[FP_Laboratory_7 | Laboratory 7]] | ||
+ | * First programming test | ||
+ | * [[FP_Laboratory_9 | Laboratory 9]] (1. Homework) | ||
+ | * [[FP_Laboratory_10 | Laboratory 10]] | ||
+ | * [[FP_Laboratory_11 | Laboratory 11]] | ||
+ | * Second programming test | ||
+ | * [[FP_Laboratory_12 | Laboratory 12]] (2. Homework) | ||
+ | * Credits for the subject given. Student can repeat one of their tests. | ||
+ | |||
+ | <!--T:28--> | ||
+ | Cheat sheet containing basic functions in [http://linedu.vsb.cz/~beh01/wiki_data/FP_cheatsheet.pdf PDF] | ||
+ | |||
+ | == Homework == <!--T:26--> | ||
+ | |||
+ | <!--T:27--> | ||
+ | * [[FP_Homework_1 | Homework 1]] | ||
+ | * [[FP_Homework_2 | Homework 2]] | ||
+ | |||
+ | == Combine study == <!--T:29--> | ||
+ | === Tutorial 1 === | ||
+ | * Presentation [http://linedu.vsb.cz/~beh01/wiki_data/Basics_of_FP.pdf#page=1 Beginning] - [http://linedu.vsb.cz/~beh01/wiki_data/Basics_of_FP.pdf#page=36 Page 34] | ||
+ | * [[FP_Laboratory_1 | Laboratory 1]] | ||
+ | * [[FP_Laboratory_2 | Laboratory 2]] | ||
+ | |||
+ | === Tutorial 2 === <!--T:32--> | ||
+ | * Presentation [http://linedu.vsb.cz/~beh01/wiki_data/Basics_of_FP.pdf#page=37 Page 35] - [http://linedu.vsb.cz/~beh01/wiki_data/Basics_of_FP.pdf#page=48 Page 46] | ||
+ | * [[FP_Laboratory_3 | Laboratory 3]] | ||
+ | * [[FP_Laboratory_4 | Laboratory 4]] | ||
+ | |||
+ | === Tutorial 3 === <!--T:33--> | ||
+ | * Presentation [http://linedu.vsb.cz/~beh01/wiki_data/Basics_of_FP.pdf#page=49 Page 47] - [http://linedu.vsb.cz/~beh01/wiki_data/Basics_of_FP.pdf#page=65 Page 63] | ||
+ | * [[FP_Laboratory_5 | Laboratory 5]] | ||
+ | * [[FP_Laboratory_6 | Laboratory 6]] | ||
+ | * [[FP_Laboratory_7 | Laboratory 7]] | ||
+ | * There will be a short test (10 points) | ||
+ | * First homework will be assigned. | ||
+ | |||
+ | === Tutorial 4 === <!--T:34--> | ||
+ | * Presentation [http://linedu.vsb.cz/~beh01/wiki_data/Basics_of_FP.pdf#page=66 Page 64] - [http://linedu.vsb.cz/~beh01/wiki_data/Basics_of_FP.pdf#page=82 Page 80] | ||
+ | * [[FP_Laboratory_9 | Laboratory 9]] | ||
+ | * [[FP_Laboratory_10 | Laboratory 10]] | ||
+ | * [[FP_Laboratory_11 | Laboratory 11]] | ||
+ | * First homework will be evaluated (25 points). | ||
+ | * First programming exercise (20 points) | ||
+ | |||
+ | === Tutorial 5 === <!--T:35--> | ||
+ | * Second homework will be assigned. | ||
+ | * Presentation [http://linedu.vsb.cz/~beh01/wiki_data/Advanced_FP.pdf#page=1 Beginning] - [http://linedu.vsb.cz/~beh01/wiki_data/Advanced_FP.pdf#page=32 Page 31] (optional, it will not be tested) | ||
+ | * [[FP_Laboratory_12 | Laboratory 12]] (optional, it will not be tested) | ||
+ | |||
+ | === Tutorial 6 === <!--T:36--> | ||
+ | * Second homework will be evaluated (25 points). | ||
+ | * Second programming exercise (20 points) | ||
+ | |||
+ | </translate> |
Revision as of 10:29, 2 August 2022
Basic introduction
Functional style of programming is well established, but for decades it was mostly used in universities and frequently it was treated like a nice concept without real practical application. Pure functional languages like Haskell, were rarely used for real life applications. Right now, functional style of programing is going through a sort of renaissance. It is embedded into many of the most popular multiparadigm languages like Python, Javascript or C#. Moreover, with the usage of JVM (Scala) or .NET CLR (F#) it is even easier to have a project accommodating various styles of programming. In this subject, we will focus on practical aspects of applications development using pure functional programming language Haskell (maybe also Elm) and on the application of principles of functional programming in other languages. Beside the programming itself, we will learn how to use some of the key infrastructure and tools supporting the development of real-life applications.
Subject aims expressed by acquired skills and competences
The aim of the course is to show the practical use of purely functional programming languages for the development of real-life applications. As a key project, a web-based information system will be implemented. In addition to pure functional programming languages and the related functional style of programming itself, students will also learn selected tools and a programming environment, that is necessary to build more complex applications.
After completing the course, participants will be able to practically apply a functional style of programming to solve real-life problems. They will be able to evaluate, if it is suitable to use it in given context and what advantages or disadvantages such approach will bring. They will get acquainted in more detail with the programming language Haskell and (probably) Elm (both are syntactically very similar). They will also learn more about the functional style of programming, which can be useful also in other technologies than for purely functional programming languages. Most of today's dominant technologies support many programming paradigms and it is more a choice of the programmer, which style will be used in the solution. The course enables you to use the functional style of programming in many aspects regardless of the used environment.
Recommended literature
- Lipovaca M.:Learn You a Haskell for Great Good!: A Beginner's Guide (1st ed.). No Starch Press, San Francisco, CA, USA, 2011 - for free at: http://learnyouahaskell.com/
- O'Sullivan B., Goerzen J., Stewart D.: Real world Haskell, O'Reilly Media, Inc. 2008. ISBN:0596514980 - for free at: http://book.realworldhaskell.org/read/
- Thompson S.: The Haskell: The Craft of Functional Programming (3nd ed.). Addison-Wesley Professional, October 2, 2011, ISBN-10: 0201882957.
Way of continuous check of knowledge in the course of semester
During the exercises, students will be programming assigned tasks. The results of these tasks will be the crucial part of the final evaluation. Additionally, a project we will create a web-based information system, where the front end will be implemented in Elm and the back end will be in Haskell. They will be connected through REST Api. Moreover, we will address other issues as the usage of database or parsing various data formats.
On these tasks, it will be demonstrated, that these functional languages are well suited for the development of real-life applications.
Software
In our lectures, we will be using Haskell Platform with Visual Studio Code. For VS Code, we will be using an extension:
More information about various options for work environments can be found: Installation Guide
Presentations
Presentations used in our lectures:
Úvod do FPR Introduction to FPR
Základy funkcionálního programování
- Page 12 CZ
- Page 26 CZ
- Page 34 CZ
- Page 42 Lists Tuples CZ
- Page 48 Theory Example CZ
- Page 55 CZ
- Page 70 CZ
- Page 80 CZ
Basics of functional Programming
Introduction to advanced topics of functional programming
Schedule:
- Lecture 1: Beginning - Page 34 (2 hours)
- Lecture 2: Page 35 - Page 42 (2 hours)
- Lecture 3: no lecture
- Lecture 4: Page 43 - Page 55 (2 hour)
- Lecture 5: Page 56 - Page 63 (1 hour)
- Lecture 6: Page 64 - Page 70 (1 hour)
- Lecture 7: Summary before Test 1
- Lecture 8: no lecture
- Lecture 9: Page 71 - Page 80 (1 hour) + Solutions for Test 1
- Lecture 10: Solutions for Homework 1
- Lecture 11: Summary before Test 2
- Lecture 12: Advanced topics (2 hours)
- Lecture 13: Advanced topics (2 hours)
- Lecture 14: Solutions for Homework 2 + Test 2
Laboratories
- Laboratory 1
- Laboratory 2
- Laboratory 3
- Laboratory 4
- Laboratory 5
- Laboratory 6
- Laboratory 7
- First programming test
- Laboratory 9 (1. Homework)
- Laboratory 10
- Laboratory 11
- Second programming test
- Laboratory 12 (2. Homework)
- Credits for the subject given. Student can repeat one of their tests.
Cheat sheet containing basic functions in PDF
Homework
Combine study
Tutorial 1
- Presentation Beginning - Page 34
- Laboratory 1
- Laboratory 2
Tutorial 2
- Presentation Page 35 - Page 46
- Laboratory 3
- Laboratory 4
Tutorial 3
- Presentation Page 47 - Page 63
- Laboratory 5
- Laboratory 6
- Laboratory 7
- There will be a short test (10 points)
- First homework will be assigned.
Tutorial 4
- Presentation Page 64 - Page 80
- Laboratory 9
- Laboratory 10
- Laboratory 11
- First homework will be evaluated (25 points).
- First programming exercise (20 points)
Tutorial 5
- Second homework will be assigned.
- Presentation Beginning - Page 31 (optional, it will not be tested)
- Laboratory 12 (optional, it will not be tested)
Tutorial 6
- Second homework will be evaluated (25 points).
- Second programming exercise (20 points)