--- Jonathan Scott Duff <[EMAIL PROTECTED]> wrote: > On Wed, Jan 29, 2003 at 08:49:42PM +0100, Juergen Boemmels wrote: > > Solution 3: The autoset sets the value to the default value. > > > > my Int @a is default(5); > > > > @a[3] = 3; # there are now 4 items in the array > > @a[2]; # was autoset 5 so returns 5 > > @a[4]; # doesn't exist, so returns 5 > > > > @a[2] = undef; # set to undef, so returns undef > > Can someone give me a realish world example of when you would want an > array that can store both undefined values and default values and > those > values are different?
Sure. Implement an array that "is computed" such that it automatically invokes a function to interpolate values that haven't been explicitly stored. (Possibly using "keys @arry", but that's a different thread.) Use that to hold values of an arbitrary function. When the function divides by zero, or does certain types of unnatural math with Inf, the value is "undefined." Likewise, when the interpolator doesn't have enough data, or the points are too far apart for confidence, the value may be "undefined". =Austin