-
I'm messing around with this library and I'm not sure if I'm fully understanding the benefit of passing in a channel. Take this example:
This would make a lot of sense to me if the RSI struct maintained a state and the input channel only represented NEW values. However, it looks like RSI is stateless so every time I call Originally, I was hoping that RSI did hold state and I could have one goroutine adding new inputs and another goroutine calling |
Beta Was this translation helpful? Give feedback.
Replies: 1 comment 1 reply
-
The Compute method maintains the state, so as you provide more input values through the input channel, you'll get more output values. So, don't call Compute multiple times, just continue using the input and result channels in your code. The input channel can get values from a file, or from the network, and as new input values are available, RSI will compute the next values and return them to you through the result channel. |
Beta Was this translation helpful? Give feedback.
The Compute method maintains the state, so as you provide more input values through the input channel, you'll get more output values. So, don't call Compute multiple times, just continue using the input and result channels in your code.
The input channel can get values from a file, or from the network, and as new input values are available, RSI will compute the next values and return them to you through the result channel.