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'  Help page about these notes  Alphabetic index  Course home  Lecture 2 - Page 23 : 35
Programming Paradigms
Recursion and 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) f on every element of a list.

Only elements on which the predicate returns true are returned from the filtering function.

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).

 

The function filter is not an essential Scheme function