Re: how to get the zero's out of a list
Re: how to get the zero's out of a list
- Subject: Re: how to get the zero's out of a list
- From: Timothy Bates <email@hidden>
- Date: Sat, 10 Mar 2001 17:47:39 +1100
On 3/10/01 1:32 PM, "John W Baxter" <email@hidden> wrote:
>
set testlist to {"0", "1", "0", "4"}
>
repeat with anItem in testlist
>
if contents of anItem is "0" then set contents of anItem to ""
>
end repeat
>
testlist
That is a very pedagogical example.
Mostly people complain when a line like
if anItem is "0" fails (because anItem is an item object with contents, not
a string.
Your example shows why, and shows people how to turn this deep power to
their advantage in a way that also helps them remember how to avoid the
pratfall.
tim
Bertrand Russell: One of the advantages of living in Great Court, Trinity I
seem to recall, was the fact that one could pop across at any time of the
day or night and trap the then young G.E. Moore into a logical falsehood by
means of a cunning semantic subterfuge. I recall one occasion with
particular vividness. I had popped across and had knocked upon his door.
Come in9, he said. I decided to wait awhile in order to test the validity
of his proposition. Come in9, he said once again. Very well9, I replied,
if that is in fact truly what you wish9.
I opened the door accordingly and went in, and there was Moore seated by the
fire with a basket upon his knees. Moore9, I said, do you have any apples
in that basket?9 No9, he replied, and smiled seraphically, as was his wont.
I decided to try a different logical tack. Moore9, I said, do you then
have some apples in that basket?9 No9, he replied, leaving me in a logical
cleft stick from which I had but one way out. Moore9, I said, do you then
have apples in that basket?9 Yes9, he replied. And from that day forth, we
remained the very closest of friends.
'Beyond the Fringe'