Beefy Boxes and Bandwidth Generously Provided by pair Networks
Problems? Is your data what you think it is?
 
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 about the Monastery: (4)
As of 2015-02-27 23:54 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    On my keyboard, Caps lock is:








    Results (457 votes), past polls