Plan Composition Using Higher-Order Functions

Elijah Rivera, Shriram Krishnamurthi, Robert Goldstone

SIGCSE International Computing Education Research Conference, 2022


Background and Context. Program planning has been a long-standing and important problem in computing education. Finding useful primitives for planning and assessing whether students are able to understand and use these primitives remain open problems. We make progress on this problem by using higher-order functions (HOFs) as planning operations. Not only are HOFs increasingly prevalent in computing broadly, some data science programming sources also recommend their use in planning solutions to data-processing pipelines, giving our task additional applicability.

Objectives. We first wish to confirm that students can understand the behavior of individual HOFs. We also seek to understand which behavioral features of these HOFs are reflected in their understanding. We then investigate their ability to plan solutions as the composition of HOFs. We examine this from two perspectives: recognizing compositions from examples, and describing compositions to solve problems.

Method. Our work is situated in early-stage tertiary education. To investigate student understanding of individual HOFs, we present them with both input-output examples and open-ended questions. To investigate the composition of HOFs, we use two formats. First, we use the same input-output format as for individual HOFs. We then ask students to construct concrete plans for programming problems defined using text. These plans were constructed using a tool that was custom-built for this work. Students were then asked to write programs to solve the same problems. We perform both quantitative and qualitative analysis of the responses.

Findings. We find students are proficient at recognizing individual HOFs through input-output examples. They use a variety of features to identify HOFs, with the most prominent features being type-based. While they do have difficulty recognizing compositions of HOFs presented in the same input-output example format, there may be simple explanations for this. Either way, students are able to produce correct plans that require composing HOFs, and can successfully translate these plans into correct code.

Implications. We believe work in this vein has many useful consequences for programming education. Explicit planning atop a vocabulary of primitive operations has not received much attention in computing; our work suggests that HOFs provide a useful initial set of planning primitives. (These are, however, generic and not problem-specific, so there is much room for growth.) However, students’ possible difficulties in recognizing HOF compositions from examples warrants further attention.



These papers may differ in formatting from the versions that appear in print. They are made available only to support the rapid dissemination of results; the printed versions, not these, should be considered definitive. The copyrights belong to their respective owners.