Course: Programming Paradigms 3

« Back
Course title Programming Paradigms 3
Course code KMI/PP3
Organizational form of instruction Lecture + Exercise
Level of course Bachelor
Year of study not specified
Semester Winter and 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
Lecturer(s)
  • Krupka Michal, doc. RNDr. Ph.D.
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
Work with Text (with Book, Textbook), Training in job and motor Skils, Laboratory Work
Learning outcomes
This course focuses on advanced topics in functional programming.
1. Knowledge Indetify pros and cons of using advanced programming constructs like macros and continuations.
Prerequisites
The course is a direct continuation of the Programming Paradigms 1 course. Basics of the Common Lisp language in the extent of the Programming Paradigms 2 course are also required.

Assessment methods and criteria
Student performance

Throughout the course, students are required to develop several small projects. Final examinations are written and oral.
Recommended literature
  • Bird R., Wadler P. (1988). Introduction to Functional Programming. Prentice Hall, Englewood Cliffs, New Jersey.
  • 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.
  • H. Abelson, G. J. Sussman. (1985). Structure and Interpretation of Computer Programs (SICP). MIT Press.
  • J. Konečný, V. Vychodil. (2006). Cvičení z paradigmat programování I, II. 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