Message Boards Message Boards

How to generalize a MovingAverage list replacements

Posted 9 years ago
POSTED BY: Pat Mac

Well, I assume that you solved that, but in case someone else is looking for a solution Nest repeatedly applies the function on the result returned `by the previous function call. BUT, you function is expecting a second element in the list for its input is missing. This is why you can operate it only once and not more, since in the second time there is no such element the input for the second time in your case is {numbers returned by the Riffle....} and it should be {{numbers returned by the Riffle...},y} after this correction the actual result that your should be expecting is First[...result of the modified scheduler...]

With a little bit enhancing your code you could also 1. Eliminate use of the Block 2. operating the Nest inside the body of the scheduler 3. Using First[.] function (all in one liner)

yehuda

Reply to this discussion
Community posts can be styled and formatted using the Markdown syntax.
Reply Preview
Attachments
Remove
or Discard

Group Abstract Group Abstract