Path: utzoo!utgpu!attcan!uunet!seismo!sundc!pitstop!sun!quintus!ok From: ok@quintus.uucp (Richard A. O'Keefe) Newsgroups: comp.lang.prolog Subject: Re: In defence of difference-lists. Message-ID: <559@quintus.UUCP> Date: 21 Oct 88 04:24:45 GMT References: <3002@mulga.oz> <16400002@clio> Sender: news@quintus.UUCP Reply-To: ok@quintus.UUCP (Richard A. O'Keefe) Organization: Quintus Computer Systems, Inc. Lines: 24 In article <16400002@clio> gerdeman@clio.las.uiuc.edu writes: >Did something go wrong in the Eureka step here? NO. >What does the variable X do? It is called for by the original specification. Namely, the INPUT of double/4 is a difference pair as well as the OUTPUT. > double(X0, X, Y0, Y) :- > double(X0, X, Y0, Y1, Y1, Y). The "input" is the "virtual" list X0\X, just as the "output" is the "virtual" list Y0\Y. > double(X, X, Y, Y, Z, Z). Testing whether there is nothing between the first two arguments is the equivalent of testing whether the "virtual" input is empty. >Why not write ; > double(X0,Y0,Y):- > double(X0,Y0,Y1,Y1,Y). Because it wouldn't meet the original specification, that's why not.