Beefy Boxes and Bandwidth Generously Provided by pair Networks RobOMonk
"be consistent"
 
PerlMonks  

Re: Euclidean algorithm Golf in Perl 6

by moritz (Cardinal)
on Jun 18, 2009 at 16:28 UTC ( #772778=note: print w/ replies, xml ) Need Help??

Help for this page

Select Code to Download


  1. or download this
        while $b != 0 {
            ($b, $a) = ($a % $b, $b);
        }
    
  2. or download this
    sub gcd ($a, $b) {
        return $a if !$b;
    ...
    }
    
    say gcd(24, 42);
    
  3. or download this
    sub gcd ($a, $b) {
        ($a, $b ... { $^x % $^y || () })[*-1]
    }
    

Log In?
Username:
Password:

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

How do I use this? | Other CB clients
Other Users?
Others studying the Monastery: (8)
As of 2014-04-19 15:50 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    April first is:







    Results (483 votes), past polls