Path: utzoo!utgpu!attcan!uunet!mcvax!enea!kth!draken!bmc1!kuling!waldau From: waldau@kuling.UUCP (Mattias Waldau) Newsgroups: comp.lang.prolog Subject: Re: Soundex revisited Message-ID: <818@kuling.UUCP> Date: 2 Sep 88 10:09:28 GMT References: <1178@tuhold> <816@kuling.UUCP> <334@quintus.UUCP> Reply-To: waldau@kuling.UUCP (Mattias Waldau) Organization: UPMAIL, Computing Science Department, Uppsala University, Sweden Lines: 38 R.O'Keefe points out that my specification of < is wrong, thank you. He also says that his program should be easier to understand since it is shorter, but I say that this only holds under the assumption that you have to read the whole program to understand what it describes. An example: we want to define the relation that removes the vowels from a sequence of letters. In Prolog we would have to write a recursive program like remove_vowels([], []). remove_vowels([Vowel|With], Without) :- vowel(Vowel), remove_vowels(With, Without). remove_vovels([Not_a_vowel|With], [Not_a_vowel|Without]) :- not_a_vowel(Not_a_vowel), remove_vowels(With, Without). If we have an explicit definition of not_a_vowel this program can also be used backwards. If we had full first order logic we could instead write remove_vowels(With, Without) <-> subsequence(Without, With) & (Elements){Element in Without -> ~vowel(Element)} saying that Without must be a subsequence of With and all elements of Without are nonvowels. It is assumed that the predicates subsequence and in are already understood by the programmer, so the number of NEW symbols that he has to write/understand are fewer then in the Prolog example above. I generally believe that quantifiers are easier to understand than recursion, but if we have recursive datastructures we still have to use recursion when defining primitive relations like in and subsequence. -- Mattias Waldau