9fans - fans of the OS Plan 9 from Bell Labs
 help / color / mirror / Atom feed
* [9fans] acid - append to empty list
@ 2007-01-11 17:55 Philip Dye
  2007-01-11 19:16 ` Russ Cox
  0 siblings, 1 reply; 2+ messages in thread
From: Philip Dye @ 2007-01-11 17:55 UTC (permalink / raw)
  To: 9fans

Why does an append to a list variable with no elements not assign the
resulting list to the variable ?

   acid: l={}
   acid: append l, 1
   {0x00000001}
   acid: l
   acid: l={1}
   acid: append l, 1
   {0x00000001, 0x00000001}
   acid: l
   {0x00000001, 0x00000001}
   acid:

Thanks,
Philip Dye




^ permalink raw reply	[flat|nested] 2+ messages in thread

* Re: [9fans] acid - append to empty list
  2007-01-11 17:55 [9fans] acid - append to empty list Philip Dye
@ 2007-01-11 19:16 ` Russ Cox
  0 siblings, 0 replies; 2+ messages in thread
From: Russ Cox @ 2007-01-11 19:16 UTC (permalink / raw)
  To: Fans of the OS Plan 9 from Bell Labs, philip.dye

> Why does an append to a list variable with no elements not assign the
> resulting list to the variable ?

It is a failure of vision on Phil's part.
It is difficult to fix but easy to work around:
always write l = append l, 1;

Russ


^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2007-01-11 19:16 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2007-01-11 17:55 [9fans] acid - append to empty list Philip Dye
2007-01-11 19:16 ` Russ Cox

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).