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

Re: Mixing up da Arrays (Golf)

by arhuman (Vicar)
on Apr 18, 2001 at 18:44 UTC ( #73513=note: print w/ replies, xml ) Need Help??


in reply to Mixing up da Arrays (Golf)

I'll definitly win the 'ugly one' contest with this one...
Its only advantage : it leaves the arrays passed as arguments untouched, (I feel that someone could make it smaller too)

The most bothering thing for me (apart from the nasty $i handling)is the stop test :
last unless (join'',@n)
Too long, and to weird, anyone to help me improve this ?

sub Mix2 { my (@r,@n); my $i=-1; while($i++>-2){ @n=map{$_->[$i]}@_; @r=(@r,@n); last unless (join'',@n) } @r; }
UPDATE :
To save one char and make it even uglier,
You can whange while($i++>-2) to while($i+++2)
(and my $i=-1; to my $i--; for another one)

"Only Bad Coders Badly Code In Perl" (OBC2IP)


Comment on Re: Mixing up da Arrays (Golf)
Select or Download Code

Log In?
Username:
Password:

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

How do I use this? | Other CB clients
Other Users?
Others making s'mores by the fire in the courtyard of the Monastery: (10)
As of 2014-12-25 05:47 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

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





    Results (159 votes), past polls