Course: Programming Paradigms 2

« Back
Course title Programming Paradigms 2
Course code KMI/PAPR2
Organizational form of instruction Lecture + Exercise
Level of course Bachelor
Year of study not specified
Semester Summer
Number of ECTS credits 5
Language of instruction Czech
Status of course Compulsory, Compulsory-optional
Form of instruction Face-to-face
Work placements This is not an internship
Recommended optional programme components None
  • Konečný Jan, RNDr. Ph.D.
  • Krupka Michal, doc. RNDr. Ph.D.
  • Kühr Tomáš, Mgr. Ph.D.
  • Hruška Miroslav, Ing.
  • Bartl Eduard, RNDr. Ph.D.
  • Procházka Pavel, Mgr.
  • Tříska Jan, Bc.
Course content
This is the third course in a series of courses whose aim is to acquaint the students with common styles of programming currently used. This course focuses on advanced topics in functional programming (lazy evaluation and macros) and on the problems connected with other programming styles (imperative, object), called multi-paradigm programming. Throughout the course, an experimental interpret of the Scheme programming language is constructed. This allows the students to understand aspects of programming covered by the course from the implementor's point of view. 1. Recapitulation of basics of Common Lisp, introduction of new language constructs and tools. 2. Macros. Two basic views of macros: macros as extensions of the language, macros as user-defined special forms. Macro expansion. Macros as templates for code rewriting. The variable capture problem and problem of multiple evaluation of parameters. When to use and when to avoid macros. Examples of usage: definitions, establishing of environments, conditional and repeated evaluation. Hygienic macros. 3. Lazy evaluation. Promises and their representation by high-order procedures. Evaluation with cached results. Impacts of lazy and cached evaluation on the computational efficiency. Using lazy evaluation in practical examples. 4. Streams. Streams vs. lists. Streams based on promises. Infinite streams and their implicit definitions. Streams representing countable infinite sets. 5. Modification of substitution model: normal-order evaluation. Variables, abstractions (lambda-expressions), applications. Substitutions, parameter renaming, reduction. A Scheme interpreter with normal-order evaluation. 6. Stack model of evaluation. Evaluation, its state, and continuation. Current continuation and escape procedures. Typical applications: nonlocal jumps, escape from the recursion, return from a subroutine. Loops with break, continue, and redo constructs. Exception handling. Generators.

Learning activities and teaching methods
Lecture, Demonstration
Learning outcomes
The students become familiar with advanced concepts of programming paradigms.
1. Knowledge Indetify pros and cons of using advanced programming constructs like macros and continuations.
KMI/PAPR1 Programming Paradigms 1

Assessment methods and criteria
Oral exam, Written exam

Active participation in class. Completion of assigned homeworks. Passing the oral (or written) exam.
Recommended literature
  • Felleisen M., Findler R. B., Flatt M., Krishnamurthi S. (2001). How To Design Programs: An Introduction to Computing and Programming. The MIT Press, Cambridge, Massachusetts.
  • GRAHAM P. (1996). ANSI Common Lisp. Prentice Hall.
  • Konečný, Vychodil. (2008). Paradigmata programování 2, díl A.. Olomouc.
  • Konečný, Vychodil. (2008). Paradigmata programování 2, díl B.. Olomouc.
  • Springer G., Friedman D.P. (1994). Scheme and the Art of Programming. The MIT Press, Cambridge, Massachusetts.

Study plans that include the course
Faculty Study plan (Version) Branch of study Category Recommended year of study Recommended semester
Faculty of Science Applied Computer Science (1) Informatics courses 1 Summer
Faculty of Science Computer Science for Education (1) Informatics courses 1 Summer
Faculty of Science Bioinformatics (1) Informatics courses 1 Summer
Faculty of Science Computer Science (1) Informatics courses 1 Summer