Ordinal numbers
Richmond
richmondmathewson at gmail.com
Thu Jul 3 15:44:57 EDT 2014
So I have a field containing a text string (nothing very special there).
BUT, I want to delete the eleventh character.
Now scripts like this:
delete the tenth char in fld "TEKST"
work superbly.
But after 'tenth' we get "in a pickle" . . . .
and we have to do this:
delete char 11 in fld "TEKST"
SO; after 'tenth' we switch from Ordinal to Cardinal numbering, which is:
1. Inconsistent.
2. Makes the "Livecode Programming is in easy to understand English"
sort of pronouncement
look a bit disingenuous.
3. The Dictionary does NOT warn users about this change:
for instance, if one types 'tenth' into the Dictionary search one gets this:
"Use the tenth keyword in an object reference or chunk expression.
It does NOT contain a "Government Health Warning" like this:
For references above 10 one must use Cardinal numbers and the syntax of
statements is
different.
-----------------------------------
Today, having got my 10-13 years olds onto importing and exporting RTF
documents;
one of them [you know the one: the one you want to both throttle and
admire for
his/her thinking about 3 kilometres in front of you] asks "how do I set
up a series of buttons to delete
the first, second and third character in a textField?" SO, told her
(let's cut out the politically correct crap; all the kids I teach who
get their heads round Livecode really quickly are girls: the boys just
lose interest)
to use:
delete the third char . . .
Of course she obviously overdosed on Coca-Cola before class and decided
to have buttons for 1st to 20th (well, she may be good at programming,
but she is still a 12 year old kid); and, obviously things go
pear-shaped at 'eleventh'.
So told the girl that at that point you have to do:
delete char 11 . . .
AND; LO! out of the mouths of babes . . .
"That's silly!"
Which it is, frankly.
SO: I did the usually "middle-aged teacher fudges around so that,
eventually, he looks even more
stupid than he does already" and told her that the best way to get
around that was to do:
delete char 1 . . .
and, of course, her reply was: "So, if that's best why did you tell me
about 'first, second' and 'third'?"
Now I had a choice of things to say at that moment:
1. "Because I'm a slob who didn't think about that problem." [possibly
the only reasons I didn't use this
one was that it was a bit early in the morning for honesty, and, as a
Bulgarian learning English she
doesn't know the word 'slob']
2. "Because I didn't think you would go beyond 'third'"
Neither of which are frankly satisfactory.
-------------------
Love from the "chalk face", Richmond.
More information about the use-livecode
mailing list