Floyd's triangle: Difference between revisions

m
(→‎AppleScript :: Functional: Added a variant defining Floyd as a partially populated matrix)
Line 1,164:
92 93 94 95 96 97 98 99 100 101 102 103 104 105
</pre>
----
 
===Straightforward===
<lang applescript>on FloydsTriangle(n)
set triangle to {}
set i to 0
setrepeat with w tofrom 1 to n
repeat n times set row to {}
set l to {}
repeat with i from (i + 1) to (i + w)
set end of lrow to i
end repeat
set end of triangle to lrow
set w to w + 1
end repeat
return triangle
end FloydsTriangle
557

edits