there's a notion that I first encountered in a course on Clean, though I suppose it doesn't originate there, of writing functions that would return a list in CPS instead, in the sense that one passes a list to be used instead of the empty list.
That allows one to avoid the quadratic runtime of continually generating intermediate lists that one needs to append together.
Today I realized that this idea is also connected to making a function tail-recursive, as well as to generalizing an induction hypothesis. I'm not sure these three notions are related outside this context, but still found it a neat observation.
That allows one to avoid the quadratic runtime of continually generating intermediate lists that one needs to append together.
Today I realized that this idea is also connected to making a function tail-recursive, as well as to generalizing an induction hypothesis. I'm not sure these three notions are related outside this context, but still found it a neat observation.