Loading ...
Sorry, an error occurred while loading the content.

RE: [hackers-il] Perl Golf

Expand Messages
  • Tal Rotbart
    Eeek that s some ugly code :) ... From: Shlomi Fish [mailto:shlomif@vipe.stud.technion.ac.il] Sent: Wednesday, May 28, 2003 4:59 PM To: Hackers-IL Subject: Re:
    Message 1 of 6 , May 28, 2003
    View Source
    • 0 Attachment
      RE: [hackers-il] Perl Golf

      Eeek that's some ugly code :)

      -----Original Message-----
      From: Shlomi Fish [mailto:shlomif@...]
      Sent: Wednesday, May 28, 2003 4:59 PM
      To: Hackers-IL
      Subject: Re: [hackers-il] Perl Golf



      And here's a classic snippet to print "Prime" if a number is prime:

      perl -wle 'print "Prime" if (1 x shift) !~ /^1?$|^(11+?)\1+$/'

      Taken from:

      http://ucan.foad.org/~abigail/Perl/Talks/Japhs/primes2.html

      Regards,

              Shlomi Fish



      ----------------------------------------------------------------------
      Shlomi Fish        shlomif@...
      Home Page:         http://t2.technion.ac.il/~shlomif/

      An apple a day will keep a doctor away. Two apples a day will keep two doctors away.

              Falk Fish


      ------------------------ Yahoo! Groups Sponsor ---------------------~--> Get A Free Psychic Reading! Your Online Answer To Life's Important Questions. http://us.click.yahoo.com/Lj3uPC/Me7FAA/CNxFAA/saFolB/TM

      ---------------------------------------------------------------------~->

      To unsubscribe from this group, send an email to: hackers-il-unsubscribe@egroups.com

       

      Your use of Yahoo! Groups is subject to http://docs.yahoo.com/info/terms/



      ________________________________________________________________________
      This email has been scanned for all viruses.

      Mercury Interactive Corporation
      Optimizing Business Processes to Maximize Business Results

      http://www.merc-int.com ________________________________________________________________________


      ________________________________________________________________________
      This email has been scanned for all viruses.

      Mercury Interactive Corporation
      Optimizing Business Processes to Maximize Business Results

      http://www.merc-int.com
      ________________________________________________________________________
    • Nadav Har'El
      ... It s an interesting example of how short regular expressions, especially when they include Perl extensions, can have abysmal, expontential, performance...
      Message 2 of 6 , May 28, 2003
      View Source
      • 0 Attachment
        On Wed, May 28, 2003, Shlomi Fish wrote about "Re: [hackers-il] Perl Golf":
        > And here's a classic snippet to print "Prime" if a number is prime:
        > perl -wle 'print "Prime" if (1 x shift) !~ /^1?$|^(11+?)\1+$/'

        It's an interesting example of how short regular expressions, especially
        when they include Perl extensions, can have abysmal, expontential,
        performance...

        On my system, finding that 45677 is prime took 1.352 seconds (compare
        to 0 seconds for "factor 45677"). Giving this perl program the number
        "65535" dumped core.

        In short, nice trick but it should be obvious it's not useful at all for
        anything but tiny numbers.

        --
        Nadav Har'El | Wednesday, May 28 2003, 26 Iyyar 5763
        nyh@... |-----------------------------------------
        Phone: +972-53-245868, ICQ 13349191 |A Nobel Peace Prize? I would KILL for one
        http://nadav.harel.org.il |of those.
      • Shlomi Fish
        ... No it isn t. Its compact but definetely not ugly. Small is beutiful. Regards, Shlomi Fish ... Shlomi Fish shlomif@t2.technion.ac.il Home Page:
        Message 3 of 6 , May 28, 2003
        View Source
        • 0 Attachment
          On Wed, 28 May 2003, Tal Rotbart wrote:

          > Eeek that's some ugly code :)
          >

          No it isn't. Its compact but definetely not ugly. Small is beutiful.

          Regards,

          Shlomi Fish

          > -----Original Message-----
          > From: Shlomi Fish [mailto:shlomif@...]
          > Sent: Wednesday, May 28, 2003 4:59 PM
          > To: Hackers-IL
          > Subject: Re: Perl Golf
          >
          >
          >
          > And here's a classic snippet to print "Prime" if a number is prime:
          >
          > perl -wle 'print "Prime" if (1 x shift) !~ /^1?$|^(11+?)\1+$/'
          >
          > Taken from:
          >
          > http://ucan.foad.org/~abigail/Perl/Talks/Japhs/primes2.html
          >
          > Regards,
          >
          > Shlomi Fish
          >
          >
          >
          > ----------------------------------------------------------------------
          > Shlomi Fish shlomif@...
          > Home Page: http://t2.technion.ac.il/~shlomif/
          >
          > An apple a day will keep a doctor away. Two apples a day will keep two
          > doctors away.
          >
          > Falk Fish
          >
          >
          > ------------------------ Yahoo! Groups Sponsor ---------------------~--> Get
          > A Free Psychic Reading! Your Online Answer To Life's Important Questions.
          > http://us.click.yahoo.com/Lj3uPC/Me7FAA/CNxFAA/saFolB/TM
          > ---------------------------------------------------------------------~->
          >
          > To unsubscribe from this group, send an email to:
          > hackers-il-unsubscribe@egroups.com
          >
          >
          >
          > Your use of Yahoo! Groups is subject to http://docs.yahoo.com/info/terms/
          >
          >
          >
          > ________________________________________________________________________
          > This email has been scanned for all viruses.
          >
          > Mercury Interactive Corporation
          > Optimizing Business Processes to Maximize Business Results
          >
          > http://www.merc-int.com
          > ________________________________________________________________________
          >
          >
          > ________________________________________________________________________
          > This email has been scanned for all viruses.
          >
          > Mercury Interactive Corporation
          > Optimizing Business Processes to Maximize Business Results
          >
          > http://www.merc-int.com
          > ________________________________________________________________________



          ----------------------------------------------------------------------
          Shlomi Fish shlomif@...
          Home Page: http://t2.technion.ac.il/~shlomif/

          There's no point in keeping an idea to yourself since there's a 10 to 1
          chance that somebody already has it and will share it before you.
        • Tal Rotbart
          Shlomi, was that a troll? :)... I m recalling with a *gulp* writing I won t get into WOL debates regarding Perl again a hundred times on the blackboard. -Tal
          Message 4 of 6 , May 28, 2003
          View Source
          • 0 Attachment
            RE: [hackers-il] RE: Perl Golf

            Shlomi, was that a troll? :)...
            I'm recalling with a *gulp* writing "I won't get into WOL debates regarding Perl again" a hundred times on the blackboard.

            -Tal

            -----Original Message-----
            From: Shlomi Fish [mailto:shlomif@...]
            Sent: Wednesday, May 28, 2003 7:26 PM
            To: 'hackers-il@yahoogroups.com'
            Subject: [hackers-il] RE: Perl Golf


            On Wed, 28 May 2003, Tal Rotbart wrote:

            > Eeek that's some ugly code :)
            >

            No it isn't. Its compact but definetely not ugly. Small is beutiful.

            Regards,

                    Shlomi Fish

            > -----Original Message-----
            > From: Shlomi Fish [mailto:shlomif@...]
            > Sent: Wednesday, May 28, 2003 4:59 PM
            > To: Hackers-IL
            > Subject: Re: Perl Golf
            >
            >
            >
            > And here's a classic snippet to print "Prime" if a number is prime:
            >
            > perl -wle 'print "Prime" if (1 x shift) !~ /^1?$|^(11+?)\1+$/'
            >
            > Taken from:
            >
            > http://ucan.foad.org/~abigail/Perl/Talks/Japhs/primes2.html
            >
            > Regards,
            >
            >       Shlomi Fish
            >
            >
            >
            > ----------------------------------------------------------------------
            > Shlomi Fish      shlomif@...
            > Home Page:       http://t2.technion.ac.il/~shlomif/
            >
            > An apple a day will keep a doctor away. Two apples a day will keep two
            > doctors away.
            >
            >       Falk Fish
            >
            >
            > ------------------------ Yahoo! Groups Sponsor
            > ---------------------~--> Get A Free Psychic Reading! Your Online
            > Answer To Life's Important Questions.
            > http://us.click.yahoo.com/Lj3uPC/Me7FAA/CNxFAA/saFolB/TM
            > ---------------------------------------------------------------------~->
            >
            > To unsubscribe from this group, send an email to:
            > hackers-il-unsubscribe@egroups.com
            >
            >
            >
            > Your use of Yahoo! Groups is subject to
            > http://docs.yahoo.com/info/terms/
            >
            >
            >
            > ______________________________________________________________________
            > __
            > This email has been scanned for all viruses.
            >
            > Mercury Interactive Corporation
            > Optimizing Business Processes to Maximize Business Results
            >
            > http://www.merc-int.com
            > ______________________________________________________________________
            > __
            >
            >
            > ______________________________________________________________________
            > __
            > This email has been scanned for all viruses.
            >
            > Mercury Interactive Corporation
            > Optimizing Business Processes to Maximize Business Results
            >
            > http://www.merc-int.com
            > ______________________________________________________________________
            > __



            ----------------------------------------------------------------------
            Shlomi Fish        shlomif@...
            Home Page:         http://t2.technion.ac.il/~shlomif/

            There's no point in keeping an idea to yourself since there's a 10 to 1 chance that somebody already has it and will share it before you.


            ------------------------ Yahoo! Groups Sponsor ---------------------~--> Get A Free Psychic Reading! Your Online Answer To Life's Important Questions. http://us.click.yahoo.com/Lj3uPC/Me7FAA/CNxFAA/saFolB/TM

            ---------------------------------------------------------------------~->

            To unsubscribe from this group, send an email to: hackers-il-unsubscribe@egroups.com

             

            Your use of Yahoo! Groups is subject to http://docs.yahoo.com/info/terms/



            ________________________________________________________________________
            This email has been scanned for all viruses.

            Mercury Interactive Corporation
            Optimizing Business Processes to Maximize Business Results

            http://www.merc-int.com ________________________________________________________________________


            ________________________________________________________________________
            This email has been scanned for all viruses.

            Mercury Interactive Corporation
            Optimizing Business Processes to Maximize Business Results

            http://www.merc-int.com
            ________________________________________________________________________
          Your message has been successfully submitted and would be delivered to recipients shortly.