• Open Menu Close Menu
  • Apple
  • Shopping Bag
  • Apple
  • Mac
  • iPad
  • iPhone
  • Watch
  • TV
  • Music
  • Support
  • Search apple.com
  • Shopping Bag

Lists

Open Menu Close Menu
  • Terms and Conditions
  • Lists hosted on this site
  • Email the Postmaster
  • Tips for posting to public mailing lists
The Pyramid - a challenge...
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

The Pyramid - a challenge...


  • Subject: The Pyramid - a challenge...
  • From: Martin Orpen <email@hidden>
  • Date: Fri, 22 Apr 2005 20:50:55 +0100

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

  • Follow-Ups:
    • Re: The Pyramid - a challenge...
      • From: David C Andrews <email@hidden>
  • Prev by Date: Re: Folder Actions: Use non-scripts?
  • Next by Date: Quark - search and replace.
  • Previous by thread: Re: Folder Actions: Use non-scripts?
  • Next by thread: Re: The Pyramid - a challenge...
  • Index(es):
    • Date
    • Thread