Re: The Pyramid - a challenge...
Re: The Pyramid - a challenge...
- Subject: Re: The Pyramid - a challenge...
- From: David C Andrews <email@hidden>
- Date: Sat, 23 Apr 2005 00:34:18 -0400
Not a "Garvey" and no "script o" but a bit simpler:
set l1 to {{1}}
repeat 5 times
set end of l1 to last item of l1)
end repeat
set t to {return}
repeat with r in l1
set end of t to contents of r
set end of t to return
end repeat
on x)
set foo to {1}
set n to count of x
set {y, z} to {2, 1}
repeat (n - 1) times
set end of foo to (item z of x) + (item y of x)
set {y, z} to {y + 1, z + 1}
end repeat
set end of foo to 1
return foo
end nextStep
t -->
{"
", {1}, "
", {1, 1}, "
", {1, 2, 1}, "
", {1, 3, 3, 1}, "
", {1, 4, 6, 4, 1}, "
", {1, 5, 10, 10, 5, 1}, "
"}
David A
On Apr 22, 2005, at 3:50 PM, Martin Orpen wrote:
Trains are delayed again... So here is an ideal opportunity for somebody to
do a "Garvey" and unleash the "script o":
set l1 to {{1}, {1, 1}}
repeat 21 times
set l2 to {}
set bar to last item of l1
set l2 to nextStep(bar)
set end of l1 to l2
end repeat
set t to {}
repeat with r from 1 to count of l1
set end of t to item r of l1
set end of t to return
end repeat
t
on nextStep(x)
set foo to {}
set end of foo to 1
set n to count of x
set {y, z} to {2, 1}
repeat (n - 1) times
set end of foo to (item z of x) + (item y of x)
set {y, z} to {y + 1, z + 1}
end repeat
set end of foo to 1
return foo
end nextStep
-->{{1}, "
", {1, 1}, "
", {1, 2, 1}, "
", {1, 3, 3, 1}, "
", {1, 4, 6, 4, 1}, "
", {1, 5, 10, 10, 5, 1}, " ...
:-)
--
Martin Orpen
_______________________________________________
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
_______________________________________________
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