Article View: comp.lang.prolog
Article #4145Re: incrementing values
From: John Dowding
Date: Sat, 03 Feb 1990 17:51
Date: Sat, 03 Feb 1990 17:51
28 lines
2043 bytes
2043 bytes
In article <31462@shemp.CS.UCLA.EDU> coleman@cs.ucla.edu (Michael Coleman) writes: >In article <17467@megaron.cs.arizona.edu> debray@cs.arizona.edu (Saumya K. Debray) writes: >>This is an excerpt from an article posted recently to another newsgroup: >>| increment(Variable) :- >>| retract(value(Variable, OldValue)), >>| NewValue is OldValue + 1, >>| assert(value(Variable, NewValue)). >>Comments? > >I saw this in the other newsgroup. My jaw dropped when I read it. >Incredible! Kind of makes you wonder how this poster would implement, say, >quicksort, or nested "for" loops in Prolog. > Just to set the record straight, Saumya Debray did not properly attribute the excerpt to Dr. David Matuszek at Unisys (dave@prc.unisys.com). Michael Coleman took this excerpt completely out of context. Dr. Matuszek is an exceptional computer scientist and programmer whose skills are beyond question. David was arguing against the notion proposed in comp.lang.misc that some varient of the construct 'x = x + 1' was most common expression in any programming language. He offered as an example Prolog, saying that he rarely had use for the equivalent of that construct in his 5 years of professional Prolog programming. His experiences are consistent with mine, that this construct is rarely useful in Prolog. As an aside, to implement 'x = x + 1' in Prolog in full generality (in the case where x is a global variable) does require some sort of side-effecting construct in most Prolog implementations.
Technical Details
Message-ID:
<19930@netnews.upenn.edu>Path:
arc1-ca.pugleaf.net!utzoo!utgpu!jarvis.csri.toronto.edu!cs.utexas.edu!rutgers!netnews.upenn.edu!linc.cis.upenn.edu!dowdingReferences:
<17467@megaron.cs.arizona.edu> <31462@shemp.CS.UCLA.EDU>Show Full Headers
Complete Article Headers
Path: arc1-ca.pugleaf.net!utzoo!utgpu!jarvis.csri.toronto.edu!cs.utexas.edu!rutgers!netnews.upenn.edu!linc.cis.upenn.edu!dowding From: dowding@linc.cis.upenn.edu (John Dowding) Newsgroups: comp.lang.prolog Subject: Re: incrementing values Message-ID: <19930@netnews.upenn.edu> Date: 3 Feb 90 17:51:37 GMT References: <17467@megaron.cs.arizona.edu> <31462@shemp.CS.UCLA.EDU> Sender: news@netnews.upenn.edu Reply-To: dowding@linc.cis.upenn.edu (John Dowding) Organization: University of Pennsylvania Lines: 28