Stories
Slash Boxes
Comments
NOTE: use Perl; is on undef hiatus. You can read content, but you can't post it. More info will be forthcoming forthcomingly.

All the Perl that's Practical to Extract and Report

use Perl Log In

Log In

[ Create a new account ]

chaoticset (2105)

chaoticset
  (email not shown publicly)
http://chaoticset.perlmonk.org/
AOL IM: chaoticset23 (Add Buddy, Send Message)
Yahoo! ID: illuminatus_foil (Add User, Send Message)

JAPH. (That's right -- I'm not Really Inexperienced any more.)

I'm not just here, I'm here [perlmonks.org], and here [javajunkies.org] too, I ramble randomly in my philosophical blog [blogspot.com] and my other blog [blogspot.com]. Soon I'll come in a convenient six-pack.

Journal of chaoticset (2105)

Friday October 03, 2003
11:55 AM

The Holy Trinity Of P

[ #15048 ]
By which I mean Perl, Python, and PHP. I'm trying to convince myself lately that it would be a good thing to learn, someday, about 3/4 as much Python as I know Perl, and 1/2 as much PHP as I know Perl.

Been working on a brain-twisting palindrome problem, where I get a word list and need to generate palindromes from it, but I haven't managed to figure out how to handle it. It's just damn hard. I'm going to attempt meditation on the Wolf over the weekend and try to figure out what kind of problem just figuring out partial palindromes is. (As in, what kind of problem in big O notation.)

The Fine Print: The following comments are owned by whoever posted them. We are not responsible for them in any way.
 Full
 Abbreviated
 Hidden
More | Login | Reply
Loading... please wait.
  • Been working on a brain-twisting palindrome problem, where I get a word list and need to generate palindromes from it

    I take it that it must be more complex than just doing reverse() on the string. Or did you mean anagram?

    • Re:reverse? (Score:5, Informative)

      by jmm (276) <johnNO@SPAMperlwolf.com> on 2003.10.03 13:48 (#24660) Journal
      reverse is an easy way to test whether a provided value is a palindrome, but he asked about generating palindromes.

      Taking the work list and making a reversed copy is only a small part of generation. For example, if you happen to choose the word "top" as a starting point, the reversed word list can be used to check possible tail ends for a palindrome ("t" doesn't work, "ot" doesn't work, "pot" is a candidate); but that is insufficient, since it doesn't find longer words that end in pot as additional candidates ("spot", "despot", "depot", "flowerpot", etc.). It also doesn't deal with the issues of deciding which words to try in the first place, ensuring that the resulting sentence is at least grammatically correct, if not meaningful, and so on.

      • It's the generation that's the hard part, yes.

        I'm trying to focus on the "what word to start with" part (because I think that the right beginning is probably the trick here), and for some reason or other I figured it might be a good idea to start with the pivot point and move outward from there. I'm starting to think that a process where possible pivot points are identified, and possible end points are identified, and then guessing ensues from there would be better than trying to grow off the pivot point

        --

        ------------------------------
        You are what you think.
  • R is for... (Score:2, Interesting)

    How about Ruby? Doesn't start with a P, but I think if you know Ruby and Perl then there's nothing to be learned from the other two Ps (although PHP is wonderful if you ever want to learn about bad language design).
    --
      ---ict / Spoon