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

Re^4: (Perl6) Groking Continuations (iterators)

by Anonymous Monk
on Oct 23, 2010 at 04:58 UTC ( #866927=note: print w/ replies, xml ) Need Help??


in reply to Re: Re: Re: (Perl6) Groking Continuations (iterators)
in thread (Perl6) Groking Continuations

Perl can do something that closely resembles an optimized tail call, but it only does so if you tell it to.

sub tail_fact { my ($num, $k) = @_; return $k->(1) unless ($num); @_ = ($num - 1, sub { return $num * $k->(shift); }); goto &tail_fact; }


Comment on Re^4: (Perl6) Groking Continuations (iterators)
Download Code

Log In?
Username:
Password:

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

How do I use this? | Other CB clients
Other Users?
Others musing on the Monastery: (5)
As of 2014-12-25 16:14 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    Is guessing a good strategy for surviving in the IT business?





    Results (160 votes), past polls