Beefy Boxes and Bandwidth Generously Provided by pair Networks
good chemistry is complicated,
and a little bit messy -LW
 
PerlMonks  

Re^2: Question about recursively generated iterators

by ikegami (Pope)
on Sep 21, 2007 at 16:48 UTC ( #640397=note: print w/ replies, xml ) Need Help??

Help for this page

Select Code to Download


  1. or download this
    sub fibonacci {
       my ($visitor) = @_;
    ...
          ($i, $j) = ($j, $i+$j);
       }
    }
    
  2. or download this
    sub fibonacci {
       my ($visitor) = @_;
    ...
       $visitor->() for $j;
       _fibonacci($j, $i+$j);
    }
    
  3. or download this
    sub fibonacci {
       my ($i, $j) = (0, 1);
    ...
       my ($i, $j) = @_;
       return ( \$j, sub { _fibonacci($j, $i+$j) } );
    }
    
  4. or download this
    {
       my $iter = make_iter(\&fibonacci);
    ...
       }
       print("\n");
    }
    
  5. or download this
    0 1 1 2 3 5 8 13 21 34 55 89 144 233 377 610
    

Log In?
Username:
Password:

What's my password?
Create A New User
Node Status?
node history
Node Type: note [id://640397]
help
Chatterbox?
and the web crawler heard nothing...

How do I use this? | Other CB clients
Other Users?
Others perusing the Monastery: (14)
As of 2014-07-23 18:38 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    My favorite superfluous repetitious redundant duplicative phrase is:









    Results (149 votes), past polls