Arnold Doray <inva...@invalid.com> wrote:It needs a bit of factoring, and I think you're doing too much on the
> Dear Forthers,
> I need to do incremental averaging. I came up with this:
> : (average) ( n An Xn+1 -- n+1 An+1 )
> : average ( seq -- d )
> REDUCE is a higher order function that takes a stream/"seq", a set of
> Note that in this Forth / also handles floating point division.
> My problem is that (AVERAGE) looks really ugly. Any suggestions for
stack. It's easy if you make the accumulator a structure in memory
with count and average, like so:
\ Increment a counter, return its value
\ Incremental average
This will also mean less stack thrashing in the word that calls
You must Sign in before you can post messages.
To post a message you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.