Fibonacci n-step number sequences: Difference between revisions

m
→‎{{header|Sidef}}: minor code simplifications
m (added whitespace before the TOC (table of contents), added a ;Task: and ;Related tasks: (bold) headers, corrected a misspelling.)
m (→‎{{header|Sidef}}: minor code simplifications)
Line 2,918:
<lang ruby>func fib(n, xs=[1]) {
loop {
var len = xs.len;
len >= 20 && break;
xs.append(xs.ft(0.max(len - n)).sum);
}
return xs;
}
 
rangefor i in (2, ..10).each { |i|
say fib(i).join(' ');
}
say fib(2, [2, 1]).join(' ');</lang>
{{out}}
<pre>
2,756

edits