Return Styles: Pseud0ch, Terminal, Valhalla, NES, Geocities, Blue Moon. Entire thread

Request translation into Perl

Name: Anonymous 2006-06-26 10:56

I'm testing something, and I'm stuck trying to write a Perl equivalent of this function because Perl's syntax is made of ugly, rudimentary, hack and fail. Could you please show me how to do this very simple thing in Perl?

function f($i = 1, $r = 17) {
    return --$r <= 0 ? null : array($i => f($i + 2, $r), $i + 1 => f($i + 3, $r));
}

Thanks!

Name: Anonymous 2006-06-28 3:27

>>18
since perl can do anonymous functions properly I'd argue that PHP's idea of a function is a joke
1. How often are you going to use functions and anonymous functions? PHP is a better tradeoff than Perl.
2. Python supports closures and anonymous functions plus default values plus list parameters plus named parameters plus list and hash call plus a decent syntax.

You don't need "my". My declares scope so you should use it
What? If you don't use my, you'll get global variables, right?

PHP's array is absolute bullshit and your code expresses that
I'm stunned at your powerful arguments why PHP's array is bad.

Your programming should reflect what you mean, not just that it fits on 3 lines
And you're trying to defend Perl with this? Perl almost invented oneliners and obfuscation itself.

16 is an absolute idiot. scope matters and spelling matters. In C your declaration declares scope, if you don't use my you aren't declaring the variable.
Ever tried a good language, like Python?

And your code is fucking ugly.


>>19
Testing memory taken by different dictionary implementations.

Newer Posts
Don't change these.
Name: Email:
Entire Thread Thread List