Vector Programming Using Generative Recursion

Marco T. Morazán
(Seton Hall University)

Vector programming is an important topic in many Introduction to Computer Science courses. Despite the importance of vectors, learning vector programming is a source of frustration for many students. Much of the frustration is rooted in discovering the source of bugs that are manifested as out-of-bounds indexing. The problem is that such bugs are, sometimes, rooted in incorrectly computing an index. Other times, however, these errors are rooted in mistaken reasoning about how to correctly process a vector. Unfortunately, either way, all too often beginners are left adrift to resolve indexing errors on their own. This article extends the work done on vector programming using vector intervals and structural recursion to using generative recursion. As for problems solved using structural recursion, vector intervals provide beginners with a useful framework for designing code that properly indexes vectors. This article presents the methodology and concrete examples that others may use to build their own CS1 modules involving vector programming using any programming language.

In Peter Achten and Heather Miller: Proceedings Seventh International Workshop on Trends in Functional Programming in Education (TFPIE 2018), Chalmers University, Gothenburg, Sweden, 14th June 2018, Electronic Proceedings in Theoretical Computer Science 295, pp. 35–51.
Published: 18th June 2019.

ArXived at: https://dx.doi.org/10.4204/EPTCS.295.3 bibtex PDF
References in reconstructed bibtex, XML and HTML format (approximated).
Comments and questions to: eptcs@eptcs.org
For website issues: webmaster@eptcs.org