Pascal's triangle: Difference between revisions

Content added Content deleted
(Updated Dyalog APL's answer/example to format Pascal's Triangle better)
Line 315: Line 315:
== Dyalog APL ==
== Dyalog APL ==
<lang apl>
<lang apl>
{A←0,⍳⍵ ⋄ ⍉A∘.!A}
{⍕0~¨⍨(-⌽A)⌽↑,/0,¨⍉A∘.!A←0,⍳⍵}
</lang>
</lang>


Line 321: Line 321:


<lang apl>
<lang apl>
{⍕0~¨⍨(-⌽A)⌽↑,/0,¨⍉A∘.!A←0,⍳⍵}5
{A←0,⍳⍵ ⋄ ⍉A∘.!A} 3
</lang>
</lang>


<pre>
<pre>
1
1 0 0 0
1 1
1 1 0 0
1 2 1
1 2 1 0
1 3 3 1
1 3 3 1
1 4 6 4 1
1 5 10 10 5 1
</pre>
</pre>