Beefy Boxes and Bandwidth Generously Provided by pair Networks
There's more than one way to do things
 
PerlMonks  

perl not omnipotent? let's see!

by Moron (Curate)
on Oct 12, 2005 at 15:56 UTC ( [id://499558]=perlquestion: print w/replies, xml ) Need Help??

Moron has asked for the wisdom of the Perl Monks concerning the following question:

This node falls below the community's threshold of quality. You may see it by logging in.

Replies are listed 'Best First'.
Re: perl not omnipotent? let's see!
by Dominus (Parson) on Oct 12, 2005 at 16:10 UTC
    Said Moron:
    those who agree with the statement could produce a piece of functionality in another language they think cannot be done in perl.

    But that's not enough. You said that "(Perl) really is the only language that can do everything any other language can do.". To prove that, you need to prove that no other language can do everything any other language can do. So for each other language l, other than Perl, you need to find something that l cannot do.

    That's the part of your statement that I thought was most mistaken, anyway.

    A reply falls below the community's threshold of quality. You may see it by logging in.
Re: perl not omnipotent? let's see!
by rnahi (Curate) on Oct 12, 2005 at 16:16 UTC

    Your claim is pointless. If you are smart and knowledgeable, you may do almost everything in every language.

    Somebody even solved The N-queens problem using pure regexes. So Perl could do mostly everything, provided that you know how to. But the real question is "it is really worth doing everything in Perl?

    See What is Perl *NOT* good at? for a more reasonable take of this issue.

    A reply falls below the community's threshold of quality. You may see it by logging in.
Re: perl not omnipotent? let's see!
by tilly (Archbishop) on Oct 12, 2005 at 17:48 UTC
    For a number of years the International Conference on Functional Programming has held an annual competition. In this competition teams are asked in a very short period of time to build a the best piece of software that they can under tight time deadlines. An example was this years task to build a program that would play a variant of cops and robbers.

    Any team may use any language.

    Most (all?) years, some teams attempt to use Perl for this. As far as I know, Perl has never managed to place in the top 3.

    That strongly suggests to me that there are some kinds of tasks which Perl is not ideal for.

      For a number of years the International Conference on Functional Programming has held an annual competition. In this competition teams are asked in a very short period of time to build a the best piece of software that they can under tight time deadlines.
      A link: ICFP 2005 Contest. To quote from it:
      • The judges' prize goes to Dylan Hackers. The judges are happy to proclaim that the Dylan Hackers are an extremely cool bunch of re-hackers.
      • First prize goes to KiebererAndXiaoTou. The judges are happy to proclaim that Haskell is the programming tool of choice for discriminating hackers.
      • Second prize goes to Dylan Hackers. The judges are happy to proclaim that Dylan is a fine programming tool for many applications.
      • Third prize goes to Combat-Tanteidan. The judges are happy to proclaim that Haskell is also not too shabby.

      Seems like O'Caml, winner for many years of 1st/2nd/3rd prize is now nothing but a distant memory. (Thanks, g.!!)

    A reply falls below the community's threshold of quality. You may see it by logging in.
Re: perl not omnipotent? let's see!
by GrandFather (Saint) on Oct 13, 2005 at 03:54 UTC

    If it is computable then any Turing complete language can compute it. Ook! is Turing Complete (appart from issues of memory size) and I can write an Ook! interpreter in Perl thus Perl (by using the Ook! interpreter) can compute anything computable.


    Perl is Huffman encoded by design.
      If it is computable then any Turing complete language can compute it.

      ++ to you, GrandFather - when all is said and done, they can all do essentially the same thing. The choice is a matter of practical considerations.

      A reply falls below the community's threshold of quality. You may see it by logging in.
Re: perl not omnipotent? let's see!
by itub (Priest) on Oct 12, 2005 at 16:11 UTC

    Sorry, I'm too lazy to provide code samples.

    The question is ambiguous. Of course, everything you can do in Perl, you can do in C, because perl is implemented in C. And everything you can do in C, you can do in assembler.

    The real question, IMO, is whether you can express things in a "natural" and efficient way in a language. I think any declarative language such as Prolog or SQL is full of examples of things that are trivial to do in those languages, but awkward and inefficient in Perl. Of course, you can use SQL and Prolog from Perl if you want...

    Another case is when you need speed and memory efficiency. Can you multiply large matrices in Perl efficiently? Not really, unless you use PDL or some other numeric extension, which happens to be implemented in C (there might be some in Fortran as well).

Re: perl not omnipotent? let's see!
by tirwhan (Abbot) on Oct 12, 2005 at 17:08 UTC
    OK, please try to do this in perl.

      I can't even do that in C, how the heck would I be able to do that in perl? :-)

      You are E-ville. I like it.

      print substr("Just another Perl hacker", 0, -2);
      - apotheon
      CopyWrite Chad Perrin

      Aw come on it's a simple one liner, surely... ;)
      perl -e 'system $_ while(<>);'

      -M

      Free your mind

Re: perl not omnipotent? let's see!
by steelrose (Scribe) on Oct 12, 2005 at 16:58 UTC
    The question shouldn't be 'CAN it be done in Perl' but 'how EFFICIENT is the Perl solution'.

    That, as most of you are aware, becomes the dreaded 'How good is/are your benchmark test(s)?' scenario.

    So, that being said, there will never be a solution that will fit everyone's criteria. Those that believe in the power of perl will continue to do so, and those that do not, will not... IMO of course.

    If you give a man a fish he will eat for a day.
    If you teach a man to fish he will buy an ugly hat.
    If you talk about fish to a starving man, you're a consultant.
Re: perl not omnipotent? let's see!
by Perl Mouse (Chaplain) on Oct 12, 2005 at 16:09 UTC
    This thing could go either way (but I disagree with your claim both ways).

    Either you mean Perl is the only language that has all constructs/techniques that any other language has. That isn't true - for instance, Perl doesn't have continuations or co-routines. Or even POSIX regular expressions (always prefer to find the longest match instead of the first match).

    Or you mean that Perl is the only language that can simulate or mimic constructs/techniques that any other language has. That isn't true either, because if it can be simulated in Perl, in can in C, as C is driving perl.

    Perl --((8:>*
Re: perl not omnipotent? let's see!
by Skeeve (Parson) on Oct 12, 2005 at 16:40 UTC

    If we limit ourselves to algorithms, Perl Mouse is right with her/his statement.

    If I recall my computatenol lectures correct, it's a prooven fact that a turing machine can compute any algorithm. So it's a fact that for any algorithm you can express in any computer language, there is a turing machine that is an implemantation for this algorithm.

    If that statement is correct, and please correct me everyone who knows better, it's a fact that a perl program can compute any algorithm. It's simply a matter of implementing a turing machine in perl.

    Agreed: It's very theoreticaly ;-)


    s$$([},&%#}/&/]+}%&{})*;#$&&s&&$^X.($'^"%]=\&(|?*{%.+=%;.#_}\&"^"-+%*) +.}%:##%}={~=~:.")&e&&s""`$''`"e
Re: perl not omnipotent? let's see!
by xdg (Monsignor) on Oct 12, 2005 at 16:06 UTC

    It's a fine challenge. Of course, given the original claim, it's important to recognize that these are not equivalent (replacing "Perl" with "A" to make the point):

    A is the only language that can do everything any other language can d +o. Everything that can be done in another language can be done in A.

    -xdg

    Code written by xdg and posted on PerlMonks is public domain. It is provided as is with no warranties, express or implied, of any kind. Posted code may not have been tested. Use of posted code is at your own risk.

Re: perl not omnipotent? let's see!
by TedPride (Priest) on Oct 12, 2005 at 17:01 UTC
    Data structures tend to take up a lot more space in Perl than they do in C++. Therefore, given a large structure and limited memory, a program could work in C++ but not in Perl.
    A reply falls below the community's threshold of quality. You may see it by logging in.
Re: perl not omnipotent? let's see!
by Anonymous Monk on Oct 12, 2005 at 18:23 UTC

    I have to admit it. Excellent choice of nick.

    As for the rest, try doing your advocacy at comp.lang.c. Perhaps you would get more challenging answers.

    A reply falls below the community's threshold of quality. You may see it by logging in.
A reply falls below the community's threshold of quality. You may see it by logging in.
A reply falls below the community's threshold of quality. You may see it by logging in.
A reply falls below the community's threshold of quality. You may see it by logging in.

Log In?
Username:
Password:

What's my password?
Create A New User
Domain Nodelet?
Node Status?
node history
Node Type: perlquestion [id://499558]
Approved by thor
help
Chatterbox?
and the web crawler heard nothing...

How do I use this?Last hourOther CB clients
Other Users?
Others musing on the Monastery: (4)
As of 2024-04-25 06:56 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found