Beefy Boxes and Bandwidth Generously Provided by pair Networks
Perl Monk, Perl Meditation
 
PerlMonks  

Re^4: Programmatically building named anchors to warp to sections

by mr_mischief (Monsignor)
on Aug 15, 2007 at 15:10 UTC ( #632764=note: print w/replies, xml ) Need Help??


in reply to Re^3: Programmatically building named anchors to warp to sections
in thread Programmatically building named anchors to warp to sections

Why wouldn't an anchor be present for every section? What does it hurt to have a "Bo" header if your first entry in the section starts with "Br"? It still effectively breaks the sections down

Perhaps the vowels are not the best place to break the entries when one considers the actual frequency of words with [uvwxyz] as the second letter compared to those with [abcd], [efgh], [ijklmn], or [opqrst] as the second letter. There's nothing particularly wrong with those choices, though.

Having uniform splitting of sections for each starting letter helps navigation quite a bit regardless of where the breaks are made or whether an entry actually starts with what the section header contains.

Replies are listed 'Best First'.
Re^5: Programmatically building named anchors to warp to sections
by mreece (Friar) on Aug 15, 2007 at 16:34 UTC
    if, for example, the phrase list begins "Art, Ant, Apple, Brown, Crab, Doom" then there would be no anchors until you get to Doom. if you don't have an aardvark or Aaron, you can end up with quite the list before you get to a word with a vowel in the second position.
      You're not understanding what I've written (or tried to write).

      Why would one not want to have the anchors simply because there is no term that exactly starts with those two letters?

      Your example just now assumes that words with different starting letters are on the same page, which is not at all the scenario proposed by the OP. I'll summarize again what's being discussed.
      1. hacker wants to have a page per letter of the alphabet.
      2. Entries on each page will be arranged alphabetically.
      3. Each page will be separated into sections based on the second letter of the entry.
      4. The choice was made to have these sections start at the vowels.
      Given the value of the same breaking points for the sections across pages regardless of the actual distribution of entries and the need to use extra memory to do otherwise, I see no reason not to have the labels present whether or not the data provides an exact substr(0,2) match to the label.
        Why would one not want to have the anchors simply because there is no term that exactly starts with those two letters?
        because the presence of the anchor suggests, at least to me, that there are such terms. a matter of personal preference, i guess.
        1. hacker wants to have a page per letter of the alphabet
        ah, that was not clear to me. while all of the example data did start with P, i saw no indication that other starting letters have their own page. in fact, i read this part (from OP):
        I can cut down the amount of vertical scrolling through a long list, by making them "Pa", "Pe", "Pi", "Po", "Pu", for each letter of the alphabet ($letter . [aeiou];)
        as saying that all terms are on one page.

        in general, i question the use of vowels for these transitions. for example, between a and e are b, c, and d, which are not very common as second letters, except for c when proceeded by s or for words that begin with vowels (which don't often have another vowel in the second position..). similar distribution issues lie between i and o.

Log In?
Username:
Password:

What's my password?
Create A New User
Node Status?
node history
Node Type: note [id://632764]
help
Chatterbox?
and the web crawler heard nothing...

How do I use this? | Other CB clients
Other Users?
Others contemplating the Monastery: (5)
As of 2021-01-20 19:04 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?
    Notices?