460-2054/05 – 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 graduate
Study languageCzech
Year of introduction2025/2026Year of cancellation
Intended for the facultiesFEIIntended for study typesBachelor
Instruction secured by
LoginNameTuitorTeacher giving lectures
BEH01 Ing. Marek Běhálek, Ph.D.
FAI0013 Ing. Michal Fait, Ph.D.
KOZ01 Ing. Jan Kožusznik, Ph.D.
VAS218 Ing. Michal Vašinek, Ph.D.
HAR0014 Ing. Markéta Vašinková, 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
Seminars
Individual consultations
Tutorials

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/

Additional study materials

Way of continuous check of knowledge in the course of semester

The course will include lectures and guided exercises in computer laboratories. Students will also have exercises prepared for practicing at home. There will be several control tests during the semester. The main part of the assessment will be two programming tests. These will be held in the computer laboratories and passing the assigned minimum of points will be a mandatory for obtaining credit from this subject.

E-learning

Basic materials are available on the educator's website: http://behalek.cs.vsb.cz/wiki/index.php/Functional_programming Consultation through MS Teams.

Other requirements

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 simple (recursive) functions in Haskell. Basic data types and how to use them. 3. Defining functions revisited: pattern matching. 4. Lists and tuples - a basic notation, how to use them in programs. 5. Working with list. 6. Introduction of higher-order functions. Functions as a first-class value. Functions map - fold. List comprehensions, list generators. 7. User defined data types and how to work with them. 8. Recursive data types and polymorphism, a partial function evaluation, basic introduction to type classes. Advanced topics 9. Theory important for pure functional programming - Introduction to lambda calculus, computation as rewriting, lazy evaluation. 10. Programming with actions - using classic arrays and handling side effect (input and output operations). 11. Monads in Haskell 12. - 13. Functional programming in traditional languages - differences between Haskell and languages like C# or Java, Haskell like Monads to represent state in other programming languages (LINQ in C#). 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. Implementation of functions that work with lists like: length, reverse, (++), zip, zipWith. 6. Usage of standard functions working with lists like map, fold, concat etc. List generators. 7. First programming test. 8. Definition of a data type for mathematical expressions. Evaluation of such expressions. 9. Definition of a binary tree. Implementation of a functions that work with such a tree. 10. Working with files. 11. Working with arrays, generating random numbers - computing the value of PI. 12. Defining new instances of Monad in Haskell 13. Second programming test.

Conditions for subject completion

Conditions for completion are defined only for particular subject version and form of study

Occurrence in study plans

Academic yearProgrammeBranch/spec.Spec.ZaměřeníFormStudy language Tut. centreYearWSType of duty
2025/2026 (B0613A140014) Computer Science INF K Czech Ostrava 3 Compulsory study plan
2025/2026 (B0613A140014) Computer Science INF P Czech Ostrava 3 Compulsory study plan

Occurrence in special blocks

Block nameAcademic yearForm of studyStudy language YearWSType of blockBlock owner

Assessment of instruction

Předmět neobsahuje žádné hodnocení.