Lecture overview -- Keyboard shortcut: 'u'  Previous page: Examples of mapping -- Keyboard shortcut: 'p'  Next page: The filtering function -- Keyboard shortcut: 'n'  Lecture notes - all slides and notes together  slide -- Keyboard shortcut: 't'  Textbook -- Keyboard shortcut: 'v'  Help page about these notes  Alphabetic index  Course home    Lecture 4 - Page 11 : 34
Functional Programming in Scheme
Higher-order Functions
Filtering

As the name indicates, the filter function is good for examining elements of a list for a certain property. Only elements which possess the property are allowed through the filter.

A filtering function applies a predicate (boolean function) on every element of a list. Only elements on which the predicate returns true are returned from the filtering function.

The function filter is not an essential Scheme function - but is part of the LAML general library

Filtering a list with a predicate f. The resulting list is the subset of the elements which satisfy f (the elements on which f returns true).