99problems: 9, 11, 13

2007-01-07 Thread gabriele renzi
Hi people, I implemented 13 from scratch because I didn't know it was already solved, in this way sub encode_direct([EMAIL PROTECTED] is copy) returns Str { my ($packed, $count); while @array { if @array[0] eq @array[1] { $count++; } else { $packed

Re: perl6-ish idiom for code and tests in one file

2007-01-07 Thread gabriele renzi
Larry Wall ha scritto: On Fri, Jan 05, 2007 at 01:40:44PM +0200, Gaal Yahas wrote: : > I think it should be possible and nice to use a macro (possibly a : > standard subroutine, I'm not sure) like : > : > testing { : > ok foo; : > } : > : > would it make sense or I'm just crazy? : : I like

Re: perl6-ish idiom for code and tests in one file

2007-01-07 Thread gabriele renzi
Larry Wall ha scritto: but the autocall into MAIN is not yet implemented. You can emulate by putting something like this as the last line in your file: MAIN(@ARGS), exit if $?FILE eq $*PROGRAM_NAME; or maybe MAIN(@ARGS), exit unless caller; if/when that works as in Perl 5. When the

Re: 99problems: 9, 11, 13

2007-01-07 Thread Ovid
--- gabriele renzi <[EMAIL PROTECTED]> wrote: > Hi people, > > I implemented 13 from scratch because I didn't know it was already > solved, in this way > I think it's cleaner, shall I commit? I definitely think your solution is cleaner, but I'd be more inclined to see multiple solutions to pro