Beefy Boxes and Bandwidth Generously Provided by pair Networks
Perl Monk, Perl Meditation

Re^2: Euclidean algorithm Golf in Perl 6

by John M. Dlugosz (Monsignor)
on Jun 19, 2009 at 14:30 UTC ( #773049=note: print w/replies, xml ) Need Help??

in reply to Re: Euclidean algorithm Golf in Perl 6
in thread Euclidean algorithm Golf in Perl 6

The last one is very interesting. Wouldn't the original arguments need to be sorted first, though? I think it only works if $a >= $b. Looking back at the original, it is the same way. The wikipedia article requires this for the modulo version (as well as the recursive version), but not for the subtraction version.

Your last one vividly illustrates how the algorithm generates successive refinements.

I also suppose that the "Golf" module, which would create 1-char Unicode aliases for a bunch of things, should include a symbol to mean "recursive call". Besides being shorter than naming the function again, you may want to do it with unnamed blocks, and &?ROUTINE is also rather verbose. ↺ perhaps?

Log In?

What's my password?
Create A New User
Node Status?
node history
Node Type: note [id://773049]
[LanX]: ha ... just read an article saying that some US presidents in the past lost their nuclear codes
[LanX]: xD
[Corion]: The code is 00000000, as always, no?
[GotToBTru]: I remember hearing about somebody misplacing a list of code phrases or something
[marto]: 12345
[GotToBTru]: the "nuclear codes" are in the case cuffed to the wrist of some guy
[LanX]: not always
[LanX]: it's up to the Supreme commander

How do I use this? | Other CB clients
Other Users?
Others imbibing at the Monastery: (7)
As of 2017-01-20 12:41 GMT
Find Nodes?
    Voting Booth?
    Do you watch meteor showers?

    Results (174 votes). Check out past polls.