Catalan numbers/Pascal's triangle: Difference between revisions

→‎{{header|Ruby}}: Rubyfy and simplify
(rearranges in order of the language.)
(→‎{{header|Ruby}}: Rubyfy and simplify)
Line 741:
<lang tcl>def catalan(num)
t = [0, 1] #grows as needed
(1.upto(.num).map do |i|
i.downto(1){|j| t[j] += t[j-1]}
t[i+1] = t[i]
Line 749:
end
 
putsp catalan(15).join(", ")</lang>
{{out}}
<pre>
<pre>[1, 2, 5, 14, 42, 132, 429, 1430, 4862, 16796, 58786, 208012, 742900, 2674440, 9694845</pre>]
</pre>
 
=={{header|Run BASIC}}==
Anonymous user