Beefy Boxes and Bandwidth Generously Provided by pair Networks
Your skill will accomplish
what the force of many cannot
 
PerlMonks  

Re: Re: (Efficiency Golf) Triangular numbers

by Abigail (Deacon)
on May 31, 2001 at 19:12 UTC ( #84597=note: print w/ replies, xml ) Need Help??


in reply to Re: (Efficiency Golf) Triangular numbers
in thread (Efficiency Golf) Triangular numbers

Well, your "agricultural" regex could be written far much simpler, in a way even that doesn't hardcode the number of digits: ! /(\d).*\1/

I'm a bit surprised to see an idiom in your program that another solution also used:

foreach (@array) { push @other, $_ if some_condition; }

Of course, that's much clearer, and more efficiently, written as:

@other = grep {some_condition} @array;

-- Abigail


Comment on Re: Re: (Efficiency Golf) Triangular numbers
Select or Download Code

Log In?
Username:
Password:

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

How do I use this? | Other CB clients
Other Users?
Others romping around the Monastery: (9)
As of 2015-07-02 06:10 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    The top three priorities of my open tasks are (in descending order of likelihood to be worked on) ...









    Results (29 votes), past polls