Vector Programming Using Structural 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 for frustration to many students given that they feel left adrift when it comes to resolving vector indexing errors. Even though the size of a vector is a natural number, there have been no efforts to define a useful recursive data definition to help beginners design vector processing functions. This article defines the concept of a vector interval and describes how to exploit its recursive structure to design vector processing functions. The described methodology provides a context beginners can use to reason about proper vector indexing instead of leaving them adrift with this responsibility. A key feature of properly using the described methodology is that if students process the correct vector interval then vector indexing errors can not arise. The classroom deployment of this approach is described in detail. Students, to date, have found vector intervals helpful in avoiding out-of-bounds indexing errors when all the vector elements of the interval are processed.

In Simon Thompson: Proceedings Sixth Workshop on Trends in Functional Programming in Education (TFPIE 2017), Canterbury, Kent UK, 22 June 2017, Electronic Proceedings in Theoretical Computer Science 270, pp. 1–17.
Students traditionally believe that the learning process flows from the professor to the students. In my case, nothing can be further from the truth. The work presented in this article is inspired by the difficulties faced and by the questions addressed to me by my beginning students. The author thanks them for providing me with valuable lessons regarding how to teach an introduction to vector programming. In particular, I thank Josephine Des Rosiers for her many heated debates with me about designing programs.
Published: 11th May 2018.

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