Tail recursive programming by applying generalization

  • Authors:
  • Manuel Rubio-Sánchez

  • Affiliations:
  • Universidad Rey Juan Carlos, Madrid, Spain

  • Venue:
  • Proceedings of the fifteenth annual conference on Innovation and technology in computer science education
  • Year:
  • 2010

Quantified Score

Hi-index 0.00

Visualization

Abstract

The design of many tail recursive algorithms can involve thinking about the status of variables and parameters, and how these change with execution flow. In other words, tail recursion is closely related to iteration and imperative programming. However, it is possible to derive tail recursive functions by exclusively using concepts inherent in recursion, such as declarative programming, induction, or problem decomposition. This paper proposes a simple methodology for designing tail recursion functions by using a declarative approach and the concept of function generalization. We have carried out an evaluation of the technique with second and third-year computer science students. Results suggest that this new point of view improves students' ability to design tail recursive programs, helps them understand the distinction between the imperative and declarative paradigms, and may reinforce their programming skills in general. Furthermore, students found the methodology easy to learn and apply, simpler than more sophisticated formal methods, and described it as fast and methodic or mechanical, as it involves a sequence of well-defined steps.