My apologies for not being more clear. I could easily simply create and pass 
around the plain seqs. But that defeats the purpose. The purpose is to maintain 
state and knowledge of the array or seq that a smarter object can do.

For example in time series data that I collect as time goes on or on historical 
data that I operate on as if I am in the moment.

It is far less expensive to maintain state of a seq than to perform operations 
on it. Especially if those operations are being done over and over.

I tried for a minimal example that would teach me what I needed to know to fix 
my understanding and solve my problem. However it is not a complete example.

An easy example is if I had a seq of which I wanted to know the sum, average, 
max and min.

All these things are easily achieved in a seq or array and computed when 
desired. They can also become expensive. What is the cost of sum, max and min 
over a arbitrarily large array? Verses the cost of maintaining a sum, max and 
min. And then you multiply that cost by every object which has a reference to 
that seq.

That is what I am trying to achieve. Nim is amazing. Its performance in those 
computation is outstanding. However, if I can avoid them in the first place. I 
can do better.

Creating such an object even in a dynamic language makes knowing the sum, max 
and min instant even over a multi-million valued array.

Then the question might be why have the array not simply maintain state. The 
array is part of the state. And I do not know that there are no other 
requirements which can only be met by the array itself.

Hope this helps.

Thanks for engaging in the conversation.

Reply via email to