comp.lang.idl-pvwave archive
Messages from Usenet group comp.lang.idl-pvwave, compiled by Paulo Penteado

Home » Public Forums » archive » Re: Would you consider this a bug?
Show: Today's Messages :: Show Polls :: Message Navigator
E-mail to friend 
Switch to threaded view of this topic Create a new topic Submit Reply
Re: Would you consider this a bug? [message #12980] Wed, 30 September 1998 00:00
thompson is currently offline  thompson
Messages: 584
Registered: August 1991
Senior Member
David Kastrup <dak@mailhost.neuroinformatik.ruhr-uni-bochum.de> writes:


> After doing

> a=[3,4,5]
> a[[2,1,0]] = a

> a will be set to [3,4,3]

> One has to write
> a[[2,1,0]] = a + 0

> in order to get the more correct seeming [5,4,3].

> Would you think this a bug?


The same correct results could also be obtained with the statement

a[[2,1,0]] = a[[0,1,2]]

I certainly would consider this a bug. I think I can understand how it comes
about, though. Evidently the contents of A are being updated directly as it
loops through the expression on the right side of the equation. On the other
hand, if one puts A+0 on the right side of the equation, it generates a
temporary array to store the results before placing them in the correct places
on the left side of the equation, so the left side doesn't get changed midway
in the process.

The solution would be that

1. If the variable on the left is indexed, AND

2. The same variable is on the right, THEN

3. Store the expression on the right in a temporary array.

William Thompson
  Switch to threaded view of this topic Create a new topic Submit Reply
Previous Topic: Re: The inverse of Extract_Slice
Next Topic: Re: Send_Event warning

-=] Back to Top [=-
[ Syndicate this forum (XML) ] [ RSS ] [ PDF ]

Current Time: Wed Oct 08 19:37:04 PDT 2025

Total time taken to generate the page: 0.00490 seconds