On Mon, 28 Feb 2005 16:54:03 -0500, deivy petrescu wrote:
On Feb 28, 2005, at 15:31, kai wrote:
set l to {}
repeat with n from 0 to 10
set n to n as string
set c to count n + 1
set l's end to {n:n, r:0 + (item c of n)}
end repeat
l
kai, when I run your script I get weird things.
First, I get an error running it in Smile. Not on SE.
When I log c, I get 1 all the time (???). By the numbers you get, I
believe you do not get the same thing
I should have seen that the lack of parens around a 'count' would cause
a problem, deivy - even though Script Editor didn't complain. That
should really have been:
-----------
set l to {}
repeat with n from 0 to 10
set n to n as string
set c to (count n) + 1
set l's end to {n:n, r:0 + (item c of n)}
end repeat
l
-----------
That works for me in Smile (which I didn't try before) - and gives the
following results:
Both Smile and Script Editor were open at the same time, and no other
applications were launched or quit between the runs.
[snip]
Last night, I tried modifying a series of the quoted integer (0 *
(item 2 of "1"), 0 * (item 2 of "2"), etc.) - and was rewarded with a
sequence that started:
I find it hard to believe myself that this happened on the same
machine. If it didn't, then I'm moving into the advanced stages of
senility. Go figure...
You probably had quit some applications from one time to the other.
Clearly something had changed - and continues to do so. I'm now getting
this:
I believe Nigel got the problem with respect to *. But It does not
explain the problems with + or -.
With regard to the lack of error, perhaps it's a similar principle.
Another weird stuff is, if there is a log (item 2 of "9") for instance
it sometimes gives the error as expected.
You want weird? I said earlier that "there seems to be a couple of ways
to change the result". What I hadn't considered was the possibility of
getting away with a real as an item number:
0 * (item 0.123456789 of "9")
--> 1.111111101
It is indeed some very weird.
You said it, deivy. How's the wording on that bug report coming along?
;-)