460-2054/01 – Functional Programming (FPR)

Gurantor departmentDepartment of Computer ScienceCredits3
Subject guarantorIng. Marek Běhálek, Ph.D.Subject version guarantorIng. Marek Běhálek, Ph.D.
Study levelundergraduate or graduateRequirementCompulsory
Year1Semesterwinter
Study languageCzech
Year of introduction2019/2020Year of cancellation2022/2023
Intended for the facultiesFEIIntended for study typesBachelor
Instruction secured by
LoginNameTuitorTeacher giving lectures
BEH01 Ing. Marek Běhálek, Ph.D.
DOL0133 Ing. Vít Doleží
FAI0013 Ing. Michal Fait, Ph.D.
PAP0081 Ing. Lukáš Papík
VAS218 Ing. Michal Vašinek, Ph.D.
Extent of instruction for forms of study
Form of studyWay of compl.Extent
Full-time Graded credit 1+2
Part-time Graded credit 14+0

Subject aims expressed by acquired skills and competences

The basic outcome will be the ability to write simple algorithms using a functional style of programing. More precisely, students will understand recursion and recursive data structures, they will be able to use high-order functions, and they will be able to define functions using the pattern matching. They will be able to use functional encapsulation mechanisms such as closures and modular interfaces and correctly reason about variables and lexical scope in programs. On practical level, they will be able to write these basic algorithms in programming language Haskell. Moreover, they will be able to recognize functional style of programming, they will understand advantages and disadvantages of this style of programming and they will be able to compare this style of programming with other approaches like imperative or object-oriented programming.

Teaching methods

Lectures
Individual consultations
Tutorials
Project work

Summary

The course introduces the functional style of programming. It covers basic properties of the functional programming like: the side effect-free programming, functions as first-class values, high-order functions, recursion, pattern matching, or function closures. Also, course introduces selected data structures like a list and a tree and a functional style of working with these structures. As a programming language, Haskell will be used. It is a pure functional, statically typed, lazy evaluated language.

Compulsory literature:

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/

Recommended literature:

Thompson S.: The Haskell: The Craft of Functional Programming (3nd ed.). Addison-Wesley Professional, October 2, 2011, ISBN-10: 0201882957. 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/

Way of continuous check of knowledge in the course of semester

During the exercise, students will be programing assigned tasks. The results of these tasks will be the crucial part of the final evaluation. At least seven evaluated tasks will be given. It will be possible to get approximately 70 points for these tasks. Additionally, two smaller projects will be given. It will be possible to get remaining points for them.

E-learning

Other requirements

There are no additional requirements for students. There are no additional requirements for students.

Prerequisities

Subject has no prerequisities.

Co-requisities

Subject has no co-requisities.

Subject syllabus:

List of presentations Basic introduction to functional programming 1. Course introduction. Introduction to Functional programming. Introduction to programming in the language Haskell (using GHC interpreter). 2. Basic function definition. How to write a simple (recursive) functions in Haskell. 3. Basic data types and how to use them. 4. Defining functions revisited: pattern matching. 5. Lists and tuples - a basic notation, how to use them in programs. 6. Working with list. 7. Introduction of higher-order functions. Functions as a first-class value. Functions map - fold. 8. List comprehensions, list generators. 9. User defined data types and how to work with them. 10. Recursive data types and polymorphism, a partial function evaluation, basic introduction to type classes. 11. Abstract data types (list, queue, tree). Advanced topics 11. Introduction to lambda calculus, computation as rewriting, lazy evaluation. 13. Input and output. 14. Programing language Elm. List of laboratories (it is expected, that all laboratories will be in a computer laboratories) 1. GHC Interpreter - basic usage 2. Implementation of basic functions computing for example: factorial, Fibonacci sequence, or the greatest common divisor. 3. Functions and operators that work with numbers, strings or characters. 4. Implementation of more complex functions that uses pattern matching, guard expressions etc. 5. - 6. Implementation of functions that work with lists like: length, reverse, (++), zip, zipWith. 7. Usage of standard functions working with lists like map, fold, concat etc. 8. List generators. 9. Evaluation of first project. 10. Definition of a data type for mathematical expressions. Evaluation of such expressions. 11. Definition of a binary tree. Implementation of a functions that work with such a tree. 12. Implementation of abstract data types - stack and queue. 13. Input and output in Haskell - writing to standard output, reading a file. 14. Evaluation of the second project.

Conditions for subject completion

Full-time form (validity from: 2022/2023 Winter semester, validity until: 2022/2023 Summer semester)
Task nameType of taskMax. number of points
(act. for subtasks)
Min. number of pointsMax. počet pokusů
Graded credit Graded credit 100 (100) 51 3
        1. Homework Project 20  0 2
        2. Homework Project 20  0 2
        1. Programming task Laboratory work 25  11 3
        2. Programming task Laboratory work 25  11 3
        Writen test Written test 10  0 2
Mandatory attendence participation: Participation in laboratories is mandatory and is controlled. Students will be informed of the scope of compulsory participation by the course guarantor at the beginning of the semester.

Show history

Conditions for subject completion and attendance at the exercises within ISP: Completion of all mandatory tasks within individually agreed deadlines. The extent of participation in the laboratories is agreed by the student with the course supervisor at the beginning of the semester.

Show history

Occurrence in study plans

Academic yearProgrammeBranch/spec.Spec.ZaměřeníFormStudy language Tut. centreYearWSType of duty
2022/2023 (B0613A140014) Computer Science INF K Czech Ostrava 1 Compulsory study plan
2022/2023 (B0613A140014) Computer Science INF P Czech Ostrava 1 Compulsory study plan
2021/2022 (B0613A140014) Computer Science INF P Czech Ostrava 1 Compulsory study plan
2021/2022 (B0613A140014) Computer Science INF K Czech Ostrava 1 Compulsory study plan
2020/2021 (B0613A140014) Computer Science INF K Czech Ostrava 1 Compulsory study plan
2020/2021 (B0613A140014) Computer Science INF P Czech Ostrava 1 Compulsory study plan
2019/2020 (B0613A140014) Computer Science INF P Czech Ostrava 1 Compulsory study plan
2019/2020 (B0613A140014) Computer Science INF K Czech Ostrava 1 Compulsory study plan

Occurrence in special blocks

Block nameAcademic yearForm of studyStudy language YearWSType of blockBlock owner

Assessment of instruction



2022/2023 Winter
2021/2022 Winter
2020/2021 Winter
2019/2020 Winter