[vienna.pm] Coroutines

Thomas Klausner domm at zsi.at
Wed Jul 4 14:45:51 CDT 2001


* * * vienna-pm-list * * *


Hi!

>          package Tree;
> 
>          sub next_inorder ($self) {
>                  yield $self->{left}->next_inorder if $self->{left};
>                  yield $self;
>                  yield $self->{right}->next_inorder if $self->{right};
>                  return undef;
>          }
> 
>          # and later...
> 
>                  while (my $node = $root->next_inorder()) {
>                          print $node->{data};
>                  }
Das schaut in der Tat sehr cool aus. 

> 	Keep simple things simple, make hard things possible.
genau :-)
--
D_omm
O_xyderkes         http://domm.zsi.at
M_echanen
M_asteuei
###
You are subscribed to vienna-pm-list as "Thomas Klausner" <domm at zsi.at>
http://www.fff.at/fff/vienna.pm/



More information about the Vienna-pm mailing list