Re: bad code to good golf

2007-12-09 Thread Marcus Holland-Moritz
On 2007-12-09, at 00:28:08 -0800, Michael G Schwern wrote: Uri Guttman wrote: i have two solutions of 33 and 24 chars so you have to beat those. the longer one is amusing enough to show it later. sub new [EMAIL PROTECTED],shift} Was my first shot at 23. Then I figured I could knock

Re: bad code to good golf

2007-12-09 Thread robert wilson
On Sunday 09 December 2007, Michael G Schwern (Michael G Schwern [EMAIL PROTECTED]) wrote: sub new [EMAIL PROTECTED],shift} Was my first shot at 23. Then I figured I could knock off that range op... my first shot was 23 also... sub new{($a,@b)[EMAIL PROTECTED];[EMAIL PROTECTED],$a} then i

Re: bad code to good golf

2007-12-09 Thread Uri Guttman
MGS == Michael G Schwern [EMAIL PROTECTED] writes: even better than just be a poorly written constructor is that it is inside a 'factory' module that is inherited by 80 other modules!! MGS If that's an example of poorly written code in your project, MGS can I come work there? It at

Re: bad code to good golf

2007-12-09 Thread Uri Guttman
rw == robert wilson [EMAIL PROTECTED] writes: rw On Sunday 09 December 2007, Michael G Schwern (Michael G Schwern rw [EMAIL PROTECTED]) wrote: sub new [EMAIL PROTECTED],shift} Was my first shot at 23. Then I figured I could knock off that range op... rw my first shot was 23

Re: bad code to good golf

2007-12-09 Thread Marcus Holland-Moritz
On 2007-12-09, at 13:23:11 -0500, Uri Guttman wrote: MGS == Michael G Schwern [EMAIL PROTECTED] writes: MGS sub new {$a=shift;[EMAIL PROTECTED],$a} MGS 21. And it's even strict clean. :) that is nice. the other replies beat it though! Nope, Michael's solution is just as short.

Re: bad code to good golf

2007-12-09 Thread A. Pagaltzis
* Uri Guttman [EMAIL PROTECTED] [2007-12-09 19:25]: * Michael G Schwern [EMAIL PROTECTED] writes: sub new { my $class = shift; return bless( [EMAIL PROTECTED], $class ); } my clean version is: sub new { my ( $class, %self ) = @_ ; return bless \%self, $class ; } i

Re: bad code to good golf

2007-12-09 Thread Michael G Schwern
A. Pagaltzis wrote: * Uri Guttman [EMAIL PROTECTED] [2007-12-09 19:25]: i don't like using shift for args if i can help it. Personally I *always* use `shift` for the invocant, but assignment from [EMAIL PROTECTED] for all other parameters in all but a few rare circumstances. So methods in

Re: bad code to good golf

2007-12-09 Thread Michael G Schwern
Uri Guttman wrote: is there any guarantee of evaluation order in arg lists? will the bless/splice always be executed before the pop? I believe it is undefined, so it's not recommended that you do anything order dependent in the argument list. But it is stable. As implemented, complex

Re: bad code to good golf

2007-12-09 Thread Uri Guttman
MGS == Michael G Schwern [EMAIL PROTECTED] writes: MGS Uri Guttman wrote: is there any guarantee of evaluation order in arg lists? will the bless/splice always be executed before the pop? MGS I believe it is undefined, so it's not recommended that you do MGS anything order dependent