Well, first of all, since the recursive call is a tail call, it's equivalent to a loop, and you could write this with neither recursion nor HOFs if you want.
HOFs are at their best when the processing of each item is independent of the rest of the list, and that's not the case here. So any purely HOF solution is likely to be a little kludgy.
But your problem reminds me that we're missing a list tool, which probably has a standard name that I'm spacing on, namely a variant of COMBINE that reports a list of partial sums or products or whatever:
(I wouldn't really implement it that way; it's very inefficient. But it's good enough for demonstration purposes.)
With that tool we can do it this way:
Of course the first three SETs could be replaced by a big composition:
and the call to INDEX OF wouldn't be necessary if I weren't an idiot and had specified FIND FIRST ITEM to report the index of
the item it finds rather than the value itself. (It's too late to change that, because FIND FIRST is used all over BJC now, but maybe, Jens, we should make a new primitive FIND INDEX OF FIRST or something? Hideous name, I know, but we could improve that.)
If the input list is really long, I'd worry about the inefficiency of computing the partial sums all the way to the end of the list and then ignoring all the ones bigger than the desired length. So I'd use streams or something.