🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Article View: comp.lang.prolog
Article #3633

Re: Soundex revisited

#3633
From: goldfain
Date: Sun, 04 Sep 1988 23:07
59 lines
2640 bytes
In comp.lang.prolog, Sep  2, 1988 by waldau@kuling.UUCP writes:
(incomplete excerpts below, bracketted with "[" symbols  -MSG)
[ 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 had full first order logic we could instead write
[ 
[ remove_vowels(With, Without) <->
[ 	subsequence(Without, With) &
[ 	(Elements){Element in Without -> ~vowel(Element)}
[ 
[ 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
(end of excerpts)

Perhaps they are NOT that much easier to  work with!  For  example, the prolog
program looks like  it correctly fulfills  the problem  specification, whereas
the richer-logic version allows the  following solutions, which were evidently
not the author's intention:

?- remove_vowels([t,o,o,m,a,n,y], Result)

Result = [t,m,n]           (this one is fine)
Result = [m,n]
Result = [t,n]
Result = [t,m]
Result = [t]
Result = [m]
Result = [n]
Result = []

This is partly fixed if we change the "->" to "<->" in the proposed clause:

    remove_vowels(With, Without) <->
        subsequence(Without, With) &
        (Elements){Element in Without <-> ~vowel(Element)}

but this still allows erroneous results for remove_vowels([x,x,x], Result)
where a non-vowel has multiple occurrences.  (This latter conclusion depends
on the precise meaning of the construct:
     (Elements){ expression }
which is not clearly specified in the note.)

On the other hand, I DO support the idea of working with a richer set of
connectives than provided in basic Prolog systems.  I would like them for
convenience.
                                                      - Mark Goldfain
Technical Details
Message-ID: <7000005@osiris.cso.uiuc.edu>
Path: arc1-ca.pugleaf.net!utzoo!attcan!uunet!peregrine!elroy!ames!ncar!tank!uxc!uxc.cso.uiuc.edu!osiris.cso.uiuc.edu!goldfain
References: <305@quintus.UUCP>

Show Full Headers
Complete Article Headers
Path: arc1-ca.pugleaf.net!utzoo!attcan!uunet!peregrine!elroy!ames!ncar!tank!uxc!uxc.cso.uiuc.edu!osiris.cso.uiuc.edu!goldfain
From: goldfain@osiris.cso.uiuc.edu
Newsgroups: comp.lang.prolog
Subject: Re: Soundex revisited
Message-ID: <7000005@osiris.cso.uiuc.edu>
Date: 4 Sep 88 23:07:00 GMT
References: <305@quintus.UUCP>
Lines: 59
Nf-ID: #R:quintus.UUCP:305:osiris.cso.uiuc.edu:7000005:000:2130
Nf-From: osiris.cso.uiuc.edu!goldfain    Sep  4 18:07:00 1988