Jump to content

Pascal's triangle: Difference between revisions

m
→‎one-liner: s/series/sequence/ per recent spec change
No edit summary
m (→‎one-liner: s/series/sequence/ per recent spec change)
Line 808:
=== one-liner ===
 
The following routine returns a lazy list of lines using the seriessequence operator (<tt>...</tt>). With a lazy result you need not tell the routine how many you want; you can just use a slice subscript to get the first N lines:
<lang perl6>sub pascal { [1], -> @p { [0, @p Z+ @p, 0] } ... * }
 
Anonymous user
Cookies help us deliver our services. By using our services, you agree to our use of cookies.