Re: creating a list of integers from a range
Re: creating a list of integers from a range
- Subject: Re: creating a list of integers from a range
- From: Graff <email@hidden>
- Date: Thu, 11 Nov 2004 23:19:37 -0500
you need to do it in a loop, if you are doing it a lot do it in a
handler:
----
on IntList(stertNum, endNum, diffNum)
set theList to {}
repeat with i from stertNum to endNum by diffNum
set theList to theList & i
end repeat
return theList
end IntList
IntList(5, 12, 1)
--> {5, 6, 7, 8, 9, 10, 11, 12}
----
- Ken
On Nov 11, 2004, at 5:00 PM, Courtney Schwartz wrote:
I am looking for something similar to this...
repeat with i from 1 to 4
--The 1 to 4 part acts like {1, 2, 3, 4}.
Something to convert a pair of numbers to a list containing that range
of integers... I wanted to just be able to say something like...
{1 to 4, 5 to 10, 11 to 12}
-- Won't work. You don't get {{1, 2, 3, 4}, {5, 6, 7, 8, 9, 10}, {11,
12}}.
but that doesn't work.
I need a list of integer lists that I can iterate over. So I made an
intRangeList(startInt, endInt) that returns a list... but that seems
inefficient, and I would rather not do that.
Is there a vanilla key word I am missing? Any other ideas aside from
the custom range-to-list function I wrote?
Courtney Schwartz
_______________________________________________
Do not post admin requests to the list. They will be ignored.
Applescript-users mailing list (email@hidden)
Help/Unsubscribe/Update your Subscription:
email@hidden
This email sent to email@hidden
_______________________________________________
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