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.
Access this chapter
Tax calculation will be finalised at checkout
Purchases are for personal use only
Preview
Unable to display preview. Download preview PDF.
References
Albert, E., Ferri, C., Steiner, F., Vidal, G.: Improving functional logic programs by difference-lists. In: He, J., Sato, M. (eds.) ASIAN 2000. LNCS, vol. 1961, pp. 237–254. Springer, Heidelberg (2000)
Colhoe, H., Cotta, J.C.: Prolog by Example. Springer, Heidelberg (1988)
Clocksin, W.F.: Clause and Effect. Prolog Programming for the Working Programmer. Springer, Heidelberg (1997)
Clocksin, W.F.: Prolog Programming. Lecture Prolog for Artificial Intelligence 2001-02 at University of Cambridge, Computer Laboratory (2002)
Clocksin, W.F., Mellish, C.S.: Programming in Prolog. Springer, Heidelberg (1981, 1984, 1987)
Clark, K.L., McCabe, F.G.: Micro-Prolog: Programming in Logic. Prentice Hall International, Englewood Cliffs (1984)
Clark, K.L., Tärnlund, S.Å.: A First Order Theory of Data and Programs. In: Gilchrist, B. (ed.) Information Processing, pp. 939–944. North Holland, Amsterdam (1977)
Dodd, T.: Prolog. A Logical Approach. Oxford University Press, Oxford (1990)
Geske, U.: How to teach difference-lists. Tutorial. In: Online Proceedings – WLP 2006 (2006) (last visited, September 06, 2007), http://www.kr.tuwien.ac.at/wlp06/T02-final.ps.gz
Marriott, K., Søndergaard, H.: Prolog Transformation by Introduction of Difference-Lists. TR 88/14. Dept. CS, The University of Melbourne (1988)
Marriott, K., Søndergaard, H.: Prolog Difference-list transformation for Prolog. New Generation Computing 11, 125–157 (1993)
Maier, D., Warren, D.S.: Computing with Logic. The Benjamin/Cummings Publisher Company, Inc. (1988)
O’Keefe, R.A.: The Craft of Prolog. The MIT Press, Cambridge (1990)
Sterling, L., Shapiro, E.: The Art of Prolog. MIT Press, Cambridge (1986); seventh printing (1991)
Zhang, J., Grant, P.W.: An automatic difference-list transformation algorithm for Prolog. In: Kodratoff, Y. (ed.) Proc. 1988 European Conf. Artificial Intelligence, pp. 320–325. Pittman (1988)
Author information
Authors and Affiliations
Editor information
Editors and Affiliations
Rights and permissions
Copyright information
© 2009 Springer-Verlag Berlin Heidelberg
About this paper
Cite this paper
Geske, U., Goltz, HJ. (2009). A Guide for Manual Construction of Difference-List Procedures. In: Seipel, D., Hanus, M., Wolf, A. (eds) Applications of Declarative Programming and Knowledge Management. INAP WLP 2007 2007. Lecture Notes in Computer Science(), vol 5437. Springer, Berlin, Heidelberg. https://doi.org/10.1007/978-3-642-00675-3_1
Download citation
DOI: https://doi.org/10.1007/978-3-642-00675-3_1
Publisher Name: Springer, Berlin, Heidelberg
Print ISBN: 978-3-642-00674-6
Online ISBN: 978-3-642-00675-3
eBook Packages: Computer ScienceComputer Science (R0)