I am interested in creating a list whose terms are defined recursively (i.e. term[i]
is a function of term[i-1]
, not a function of i-1
).
I figured that if makelist
works serially, then calling a previous term should not be an issue; however, the documentation does not explicitly address how the terms are generated.
An initial attempt (NB: even though the output here could be achieved using a function of the index, the point was to create a simple example that tested the ability of calling previous terms, within makelist
):
test:
makelist(block([ ],
/* list item set to 1 for first term of the list, and to previous list item, thereafter */
if i = 1
then addend
else test[i-1]
)
, i, 5);
but this returns [1, test[1], test[2], test[3], test[4] ]
so it doesn't seem to actually access the values of test
.
I tried various experiments, including initializing test
; including a call to test in the block, i.e. block([ test:test ], ...
, and a few others, but haven't been able to get the desired result.