in reply to Golf: List spliting
my @l= (0..25); sub c{0==$_[0]%3} sub S{my($c,$l,@r)=@_;@$l=grep&$c($_)?!push@r,$_:1,@$l;@r} my @r= S(\&c,\@l); print "\@r=(@r)\n\@l=(@l)\n"; __END__ Output: @r=(0 3 6 9 12 15 18 21 24) @l=(1 2 4 5 7 8 10 11 13 14 16 17 19 20 22 23 25)
51 characters for the middle. I could shorten it by hard-coding &$c() as c() but that doesn't seem proper.
- tye (but my friends call me "Tye")
|
|---|