Path: csiph.com!x330-a1.tempe.blueboxinc.net!usenet.pasdenom.info!aioe.org!feeder.news-service.com!xlned.com!feeder1.xlned.com!npeer.de.kpn-eurorings.net!npeer-ng0.de.kpn-eurorings.net!feed.news.schlund.de!schlund.de!news.online.de!not-for-mail From: Christoph Bersch Newsgroups: comp.graphics.apps.gnuplot Subject: Re: Plotting y(i)-y(i-1) vs x(i) Date: Wed, 20 Jul 2011 22:17:12 +0200 Organization: 1&1 Internet AG Lines: 25 Message-ID: References: <3e1c6c29-4dbb-41eb-9d2c-b39433087638@glegroupsg2000goo.googlegroups.com> NNTP-Posting-Host: p54938ef1.dip0.t-ipconnect.de Mime-Version: 1.0 Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: 7bit X-Trace: online.de 1311193033 18053 84.147.142.241 (20 Jul 2011 20:17:13 GMT) X-Complaints-To: abuse@einsundeins.com NNTP-Posting-Date: Wed, 20 Jul 2011 20:17:13 +0000 (UTC) User-Agent: Mozilla/5.0 (X11; U; Linux x86_64; de-AT; rv:1.9.1.16) Gecko/20110505 Icedove/3.0.11 In-Reply-To: <3e1c6c29-4dbb-41eb-9d2c-b39433087638@glegroupsg2000goo.googlegroups.com> Xref: x330-a1.tempe.blueboxinc.net comp.graphics.apps.gnuplot:457 On 20.07.2011 19:55 Victor wrote: > > On Wednesday, July 20, 2011 1:03:32 AM UTC-6, Christoph Bersch wrote: >> y = 0 >> oldy = 0 >> diff(x) = (oldy = y, y = x, y - oldy) > In what part of documentation can I read about how this function > works. I don't quite understand the relationship between oldy, y and x. About user-defined function, see section 13.4 "User-defined variables and functions". The expression (a, b, c) is called "serial evaluation" and explained in sec. 13.2.2 "Binary Operators": Serial evaluation occurs only in parentheses and is guaranteed to proceed in left to right order. The value of the rightmost subexpression is returned. So, to come back the my code, the evaluation order is 1. oldy = y # shift the previous y value to oldy 2. y = x # y now hold the current value 3. y - oldy # return the difference Christoph