Re: What is this?
Re: What is this?
- Subject: Re: What is this?
- From: kai <email@hidden>
- Date: Tue, 1 Mar 2005 01:24:24 +0000
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:
{{n:"0", r:6.33208636813952E-308}, {n:"1", r:1.0}, {n:"2", r:2.0},
{n:"3", r:3.0}, {n:"4", r:4.0}, {n:"5", r:5.0}, {n:"6", r:6.0}, {n:"7",
r:7.0}, {n:"8", r:8.0}, {n:"9", r:9.0}, {n:"10", r:10.0}}
However, Script Editor now returns this:
{{n:"0", r:1.43565589696582E-304}, {n:"1", r:1.0}, {n:"2", r:2.0},
{n:"3", r:3.0}, {n:"4", r:4.0}, {n:"5", r:5.0}, {n:"6", r:6.0}, {n:"7",
r:7.0}, {n:"8", r:8.0}, {n:"9", r:9.0}, {n:"10", r:10.0}}
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:
"1" --> 1.41429518792415E-304
"2" --> 2.82859037584831E-304
"3" --> 4.24288556377246E-304
And the second way to get different results? Today, I tried running
the same script and was presented with this:
"1" --> 1.38937436070887E-304
"2" --> 2.77874872141775E-304
"3" --> 4.16812308212662E-304
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:
"1" --> 1.43565589696582E-304
"2" --> 2.87131179393164E-304
"3" --> 4.30696769089747E-304
However, in Smile (still with no other changes to my system), I get:
"1" --> 6.33208636813952E-308
"2" --> 1.2664172736279E-307
"3" --> 1.89962591044185E-307
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?
;-)
---
kai
_______________________________________________
Do not post admin requests to the list. They will be ignored.
Applescript-users mailing list (email@hidden)
Help/Unsubscribe/Update your Subscription:
This email sent to email@hidden