Fibonacci n-step number sequences: Difference between revisions

Content added Content deleted
(Realize in PascalABC.NET)
Line 3,320: Line 3,320:
I first define a high order function to generate infinite sequences given a lambda and a seed.
I first define a high order function to generate infinite sequences given a lambda and a seed.
<syntaxhighlight lang="pascal">
<syntaxhighlight lang="pascal">
// Fibonacci n-step number sequences. Nigel Galloway: September 8th., 2022
// unfold infinite sequences. Nigel Galloway: September 8th., 2022
function unfold<gN,gG>(n:Func<gG,(gN,gG)>; g:gG): sequence of gN;
function unfold<gN,gG>(n:Func<gG,(gN,gG)>; g:gG): sequence of gN;
begin
begin
Line 3,329: Line 3,329:
function unfold<gN,gG>(n:Func<array of gG,(gN,array of gG)>;params g:array of gG): sequence of gN := unfold(n,g);
function unfold<gN,gG>(n:Func<array of gG,(gN,array of gG)>;params g:array of gG): sequence of gN := unfold(n,g);
</syntaxhighlight>
</syntaxhighlight>

===The Task===
===The Task===
Like the Pascal above but not iffy, not loopy, and not as long!
Like the Pascal above but not iffy, not loopy, and not as long!