in reply to Re: Mixing up da Arrays (Golf) (Russ=53)
in thread Mixing up da Arrays (Golf)
With ?: I can save some, and shaving with map$foo,@list tricks I can save some more. This brings the safe version down to 48 characters.
That matches what was done unsafely before. But unfortunately for sanity's sake observe the following 33 character entry:sub Mix { map{my$i=$_;map$i<@$_?$$_[$i]:(),@_}0..map@$_,@_ }
I have written saner code...sub Mix { map{splice@$_,0,1}map@_,map@$_,@_ }
UPDATE
Saved 3 chars on the unsafe example, there is no need
for a nice numerical list when I will be just converting
the elements...
UPDATE 2
Sheesh. And the safe example can be modified to the
rather bizarre 45 character beast:
UPDATE 3sub Mix { map{splice@$_,0,1}map@_,map@$_,@_=map[@$_],@_ }
So that is (barring the unexpected) my final answer.sub Mix { map{map{splice@$_,0,1}(@_)x@$_}@_ }
|
---|