Pascal's triangle: Difference between revisions
Content added Content deleted
No edit summary |
m (→one-liner: s/series/sequence/ per recent spec change) |
||
Line 808: | Line 808: | ||
=== one-liner === |
=== one-liner === |
||
The following routine returns a lazy list of lines using the |
The following routine returns a lazy list of lines using the sequence 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] } ... * } |
<lang perl6>sub pascal { [1], -> @p { [0, @p Z+ @p, 0] } ... * } |
||