Pascal's triangle: Difference between revisions

Content added Content deleted
Line 872:
 
pascal = choose**ziDS+ iota*t+ iota+ successor</lang>
This solution uses direct summation. The algorithm is to
insert zero at the head of a list (initially the unit list <1>), zip it with its reversal,
map the sum over the list of pairs, iterate n times, and return the trace.
<lang Ursala>
#import std
#import nat
 
pascal "n" = ~&tx (repnext"n" ^C\~& sum*NhCixpNiCixp) <<1>>
</lang>
test program: