Re: more yield tricks ((was Re: C in RFC 31

2000-09-13 Thread Damian Conway
> foreach @bigarray { > sub { > yield (push @array1, $_); > yield (push @array2, $_); > yield (push @array3, $_); > push @array4, $_; > }->(); > }; > > :-) As I've said before, Randal, you're a bad, bad man. Of co

Re: more yield tricks ((was Re: C in RFC 31

2000-09-13 Thread Randal L. Schwartz
> "Damian" == Damian Conway <[EMAIL PROTECTED]> writes: >> foreach @bigarray { >> yield (push @array1, $_); >> yield (push @array2, $_); >> yield (push @array3, $_); >> push @array4, $_; >> }; Damian> Except that C is like C and breaks out of the current Damian> *subroutine*, not the current

Re: more yield tricks ((was Re: C in RFC 31

2000-09-13 Thread Damian Conway
>foreach @bigarray { >yield (push @array1, $_); >yield (push @array2, $_); >yield (push @array3, $_); >push @array4, $_; >}; Except that C is like C and breaks out of the current *subroutine*, not the current block. Damian

more yield tricks ((was Re: C in RFC 31

2000-09-13 Thread David L. Nicol
Damian Conway wrote: > > What you want is: > > %newhash = map {yield $_; transform($_)} %oldhash; > > This flattens the %oldhash to a sequence of key/value pairs. Then the > first time the map block is called (i.e. on a key) it immediately > returns the key. The second time, it resumes

Re: C in RFC 31

2000-09-12 Thread Damian Conway
> Have you considered adding a C example to RFC 31? Yield would add > multiple output items per input item better IMO than the current practice > of accumulating a list of output items and returning it at the end. > >%newhash = map {yield $_; transform $somehash{$_}} @keysubse

C in RFC 31

2000-09-12 Thread David L. Nicol
Damian Conway wrote: > :-) > > I did consider that too, but the problem is that according to RFC 31 a > C leaves the future entry point of a block at the next statement > after the C, whereas the block needs to start from the beginning on > each iteration. > > Damian Have you considered addin