Path: utzoo!utgpu!jarvis.csri.toronto.edu!cs.utexas.edu!swrinde!zaphod.mps.ohio-state.edu!samsung!aplcen!haven!udel!burdvax!dave From: dave@PRC.Unisys.COM (David Lee Matuszek) Newsgroups: comp.lang.misc Subject: Re: NOT Educating FORTRAN programmers to use C Message-ID: <12576@burdvax.PRC.Unisys.COM> Date: 19 Jan 90 21:06:30 GMT References: <15623@haddock.ima.isc.com> <8960003@hpfcso.HP.COM> <1990Jan17.042608.447@esegue.segue.boston.ma.us> <12950@cbnewsc.ATT.COM> Sender: news@PRC.Unisys.COM Organization: Unisys Corporation, Paoli Research Center; Paoli, PA Lines: 30 In article <12950@cbnewsc.ATT.COM> res@cbnewsc.ATT.COM (Rich Strebendt) writes: > Also, it should also be kept in mind that, >while it is fun to figure out how to optimize very exotic constructs, >the most frequently occuring construct in any programming language is >equivalent to the construct x += 1 Er, not quite *any* programming language. I have been programming professionally in Prolog for the last five years, and I need to do this sort of thing maybe once or twice a year. BTW, here's how to do it: increment(Variable) :- retract(value(Variable, OldValue)), NewValue is OldValue + 1, assert(value(Variable, NewValue)). ..., increment(x), ... but as this makes two modifications to the database and is therefore pretty expensive (not to mention poor style), you don't want to do it too often. Moral: "Toto, I don't think we're in Kansas anymore." -- Dave Matuszek (dave@prc.unisys.com) -- Unisys Corp. / Paoli Research Center / PO Box 517 / Paoli PA 19301 -- Any resemblance between my opinions and those of my employer is improbable. << Those who fail to learn from Unix are doomed to repeat it. >>