Beefy Boxes and Bandwidth Generously Provided by pair Networks
Syntactic Confectionery Delight
 
PerlMonks  

Re^2: Question about recursively generated iterators

by ikegami (Patriarch)
on Sep 21, 2007 at 16:48 UTC ( [id://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
Domain Nodelet?
Node Status?
node history
Node Type: note [id://640397]
help
Chatterbox?
and the web crawler heard nothing...

How do I use this?Last hourOther CB clients
Other Users?
Others making s'mores by the fire in the courtyard of the Monastery: (4)
As of 2024-03-28 18:01 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found