[Omake] lazy values in arrays?

Aleksey Nogin nogin at metaprl.org
Mon Jan 29 10:10:56 PST 2007


On 28.01.2007 23:53, Erick Tryzelaar wrote:

> Is there any way to store a lazy value in an array? The obvious route 
> doesn't work:
> 
> % x=1
> - : "1" : Sequence
> % y = $(array $`x 1 2 3)

For the array function, the 1-argument case (which is equivalent to the 
1-line "y[] = ..." form) is special - because it needs to break its 
argument into pieces along the whitespace, it has to evaluate it eagerly.

Use

y = $(array $`x, 1, 2, 3)

or, equivalently

y[] =
   $`x
   1
   2
   3

or

y[] =
    $`x

y[] += 1 2 3

Aleksey


More information about the Omake mailing list