Information Technology Reference
In-Depth Information
Table 12.7 Recursive patterns for list processing
Recursive patterns for list processing—map, filter, reduce
Map is a function that for a given list L1 and a given unary function F, returns a list L2,
in which F was activated on each of L's elements.
Filter is a function that for a given list L1 and a given Boolean function F, returns a list
L2 that includes only the elements from L1 that satisfy the F condition.
Reduce is a function that receives a list L1 and a binary function F and returns an object
(not necessary a list) that equals the result of the activation of F on all L1's elements.
Examples for recursive patterns
Recursive pattern
Input list L1
Input function F
Output
Map
10, 7, − 2, 25
Double
20, 14, − 4, 50
(list)
Filter
10, 7, − 2, 25
Positive?
10, 7, 25 (list)
Reduce
10, 7, − 2, 25
Add
40 (the sum of
L1 elements)
Activity 102: Recursion Animation
Chapter 8 focuses on lab-based teaching. In addition to the tree activity pre-
sented in this chapter (see Sect. 12.6), it is recommended to use animations
(such as the Jeliot environment or a similar IDE) and demonstrate the tracing
of Fibonacci or a tree drawing.
Activity 103: The Use of a Tutorial for Exploring Recursive Algorithm Time
Efficiency
Chapter 8 focuses on lab-based teaching. The use of tutorials can add several
layers to the learning process since each student can progress according to his
or her understanding. Pevac ( 2012 ) presents the use of an application-based
tutor, specifically built to support the learning of recursive algorithms, and
reports on the tutor's usefulness in improving student learning. In that context,
an optional activity would ask students in the MTCS course to experience the
tutor application and comment on its potential usefulness in relation to learning
difficulties in understanding of recursion (for example, the difficulties explored
in the paper presented in activity 94).
Activity 104: Design of Questions about Recursion
In the spirit of Chap. 9, an optional activity would ask students to build differ-
ent types of questions for recursion.
 
Search WWH ::




Custom Search