Category:Wren-iterate

Revision as of 19:10, 28 February 2023 by PureFox (talk | contribs) (Created page for 'Wren-iterate' module (moving iteration classes from Wren-trait).)
(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)
Library
This is an example of a library. You may see a list of other libraries used on Rosetta Code at Category:Solutions by Library.

Wren-iterate is a module which enhances Wren's built-in iteration facilities by providing the wrapper classes: Stepped, Reversed and Indexed plus a helper class SeqEntry. The first two of these enable sequences to be iterated in either (or both) a stepped fashion (steps > 1) or in reverse. The third enables the iteration to include the zero-based index of the sequence elements and SeqEntry assists with this.

It also contains the Loop class which enables a parameterless function to be called repeatedly either for a fixed number of times or until some condition is met. The function is always called at least once.

It is the forty-first in a series of modules (listed on the language's main page) designed to assist with writing Rosetta Code tasks so the same code does not have to be written or copy/pasted time and time again thereby bloating a task's script code unnecessarily.

To use it all you need to do is to copy the source code (in the talk page) to a text file called iterate.wren and place this in the same directory as the importing script or module so the command line interpreter can find it.