A Guide for Manual Construction of Difference-List Procedures

  • Authors:
  • Ulrich Geske;Hans-Joachim Goltz

  • Affiliations:
  • University of Potsdam,;Fraunhofer FIRST, Berlin,

  • Venue:
  • Applications of Declarative Programming and Knowledge Management
  • Year:
  • 2009

Quantified Score

Hi-index 0.00

Visualization

Abstract

The difference-list technique is an effective method for extending lists to the right without using the append/3 procedure. There exist some proposals for automatic transformation of list programs into difference-list programs. However, we are interested in a construction of difference-list programs by the programmer, avoiding the need of a transformation. In [9] it was demonstrated, how left-recursive procedures with a dangling call of append/3 can be transformed into right-recursion using the unfolding technique. For some types of right-recursive procedures, the equivalence of the accumulator technique and difference-list technique was shown and rules for writing corresponding difference-list programs were given. In the present paper, improved and simplified rules are derived which substitute the formerly given ones. We can show that these rule allow us to write difference-list programs which supply result-lists that are either constructed in top-down -manner (elements in append order) or in bottom-up manner (elements in inverse order) in a simple schematic way.