Re: What is this?
Re: What is this?
- Subject: Re: What is this?
- From: Nigel Garvey <email@hidden>
- Date: Tue, 1 Mar 2005 12:44:09 +0000
Doug McNutt wrote on Mon, 28 Feb 2005 16:34:23 -0700:
>OS 9.1, SE 1.8.3
>
>1 * (item 2 of "2048") --> 0
>1 * (item 2 of "4096") --> 0
>1 * (item 2 of "8192") --> 1
>1 * (item 2 of "16384") --> 6
>1 * (item 2 of "32768") --> 2
>1 * (item 2 of "49152") --> 9
>1 * (item 2 of "65536") --> 5
>1 * (item 2 of (2 ^ 13 as text)) --> 1
>
>set alist to {}
>repeat with jill from 10 to 16
> set res to 1 * (item 2 of (2 ^ jill as text))
> set alist to alist & res
>end repeat
>list
>--> "Cant make "." into a number"
>Sigh
When you get up to (2 ^ 14 as text), the result is in exponential format,
so item (ie. character) 2 of it is the decimal point. It exists, but
can't be coerced to number for the multiplication.
For the "Petrescu effect" - if that's what you were trying - the
reference must be to an item that doesn't exist, such as '(item 99 of (2
^ jill as text))'.
Kai wrote on Tue, 1 Mar 2005 01:24:46 +0000:
>That's a pretty nifty bunch of examples, Nigel! And you may not even
>need that initial integer...
>
>return * ("9.9"'s ninth line)
>
>"" - (some record of "1984")
Hi, Kai. I think you've found yet another anomaly! It seems that in OS X,
empty strings spaces, line feeds, and returns can be coerced to the
integer 0! (In OS's 9.2.2 and 8.6, this is only possible with empty
strings.)
deivy petrescu wrote on Mon, 28 Feb 2005 21:35:46 -0500:
>> [integer][dual-class math operator][reference consisting of ¬
>> [singular, plural, or numbered class, property, or constant] of
>> [numeric string]]
>
>Nigel,
>May be you are right but there is still a problem:
>
>a. (character 5 of "q") --> error: "Can't get character 5 of \"q\"."
>
>b. 1 * (character 5 of "q") --> "Can't make \"q\" into a number."
>
>c. 1.0 * (character 5 of "q") --> "Can't make character 5 of \"q\"
>into a number."
Hi, Deivy. That's right. "q" isn't a numeric string.
In view of Doug's and Kai's posts and something else I've just tried,
perhaps the bug specification above should be refined to:
[integer or item that can be coerced thereto] ¬
[dual-class math operator] ¬
[reference to non-existent item, consisting of ¬
[singular, plural, or numbered class, property, or constant] ¬
of [numeric string or actual number]]
NG
_______________________________________________
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