My understanding is that the P6 way to do that is to return a Capture containing the desired return values (which can lazily do things only when accessed) in the appropriate slots.
On 7/28/09, Jon Lang <datawea...@gmail.com> wrote: > Larry Wall wrote: >> Moritz Lenz wrote: >> : Either it's parsed as '@a[0] = (W, W)' (list assignment), then @a should >> : get both elements, and so should @z. >> >> Not according to S03, at least by one reading. �...@a[0] as a scalar >> container only wants one item, so it only takes the first item off >> the list, and the list assignment produces a warning on the second >> because it's discarded. Since an assignment returns its left side, >> only one element is available to @z from @a[0]. > > So, do we still have p5's 'want_array' (or whatever it was called)? > That is, the predicate that tells the you whether the function is > being called in item or list context? I know that the generalized > 'want' function proved to be unworkable; but I'd expect p6 to at least > be able to do everything that p5 can do; and that includes functions > that are aware of whether they're being used as singular or plural. > > -- > Jonathan "Dataweaver" Lang > -- Sent from my mobile device Mark J. Reed <markjr...@gmail.com>