problem with counting words
larry at significantplanet.org
larry at significantplanet.org
Sun Oct 12 22:10:26 EDT 2014
Hello Kay,
Mark gave me a short explanation of why it is good to see the words within
quotes as one word and now you've given a longer and more detailed
explanation.
So I thank you and I will stop throwing rocks at my computer.
Larry
P.S. I still want to understand how to write my own functions that I can use
right within any script of any stack.
----- Original Message -----
From: "Kay C Lan" <lan.kc.macmail at gmail.com>
To: "How to use LiveCode" <use-livecode at lists.runrev.com>
Sent: Sunday, October 12, 2014 7:58 PM
Subject: Re: problem with counting words
> On Mon, Oct 13, 2014 at 7:45 AM, Richard Gaskin
> <ambassador at fourthworld.com>
> wrote:
>
>>
>> I hear ya', but like so many other oddities in the language this one came
>> from Apple,
>>
>
> Sheer brilliance! One of the first analogies of HyperCard was that it was
> a
> an electronic rolodex. Here is a list of names:
>
> Abu Musab Al-Zarqawi
> Camilla Parker-Bowles
> Catherine Zeta-Jones
> Claude Levi-Strauss
> D'Arcy Corrigan
> Daniel Day-Lewis
> David Ben-Gurion
> Dodi Al-Fayed
> Florence Griffith-Joyner
> Gilbert O'Sullivan
> Gloria Macapagal-Arroyo
> Jean-Claude Van Damme
> Jimmy O'Dea
> Justine Henin-Hardenne
> Kareem Abdul-Jabbar
> Karim Abdul-Jabbar
> Kristin Scott-Thomas
> Maddox Jolie-Pitt
> Michael O'Leary
> Olivia Newton-John
> Peter O'Toole
> Sinéad O'Connor
> Tim Brooke-Taylor
> Ralph Twistleton-Wykham-Fiennes
>
> So lets say you want to sort these by surname - a kind of rolodex thing to
> do.
>
> sort lines of myListOfNames by word of -1 each
>
> will result in only one mistake
>
> sort lines of myListOfnames by trueword -1 of each --if you are on LC7.0
>
> will result in basically the same messed up result most other programming
> languages will give you. Put it in and word processor and see how you go.
>
> Please feel free to try and write your own function that is more
> successful
> and more efficient than the beautiful one liner Bill Atkinson gave us.
> Even
> if you had wordDel it wouldn't help much. I can't imagine the amount of
> hours that have been wasted, especially on genealogical websites, trying
> to
> unfathom why double barrelled names never sort correctly. This is also
> compounded by the certain fact that some people will put a space between
> the last given name and the Surname, some a tab, and some will 'format'
> the
> data by placing multiple spaces in between names so that things 'line up
> nicely' - and are then confused as to why it only looks that way on their
> screen an not on someone else's. One of the reasons double barrelled names
> have picked up the '-' is to help computers recognise them as a single
> word.
>
> Also;
>
> put myVariable into fld Not A Variable
>
> doesn't work
>
> put myVariable into fld "Not A Variable"
>
> does. The ability to recognise words in quote as a single entity is
> extremely important. Yes, we don't typically think of such as a single
> word, but when we understand that computers don't think like us, and we do
> understand why things are the way they are, such oddities can be
> manipulated in many powerful ways to our own advantage. It is also helpful
> when we understand such things that we don't go around replacing one
> character willy nilly with another character. ~ [tilde] for instance is
> one
> character I'd never use as it has a special meaning in many computer
> languages; as does / \ < > . * and many others. If we had some text that
> contained both straight and curly quotes and replaced the straight quotes
> with curly quotes so we could get a word count, and then changed the curly
> quotes back to straight quotes, the finL text is not the same as it
> started
> - and this could cause problems. Today your function might work perfectly
> for today's problem, but next month, or next year, when you start
> expanding
> your LC skills and try working with SQL databases, or Servers and network
> connections, every now and then someone will report a bug that your app
> does something strange. You may never be able to track it down because it
> just happens that once every million DB calls a random user happens to use
> data that contains a character that you never use yourself and thought no
> one else would. I have a particular liking to numToChar(127) myself.
>
> Yep, no other programming language might define a word like LC defines a
> word, but I for one am EXTREMELY thankful for that.
> _______________________________________________
> use-livecode mailing list
> use-livecode at lists.runrev.com
> Please visit this url to subscribe, unsubscribe and manage your
> subscription preferences:
> http://lists.runrev.com/mailman/listinfo/use-livecode
More information about the use-livecode
mailing list