Category:Wren-trait: Difference between revisions
(Changed blurb following addition of a new class.) |
(Changed blurb following addition of new classes.) |
||
Line 2: | Line 2: | ||
'''Wren-trait''' is a module which provides the abstract classes: Comparable, Cloneable and CloneableSeq. The first of these enables child classes to easily support the basic comparison operators and the latter two enables such classes to identify themselves as ''cloneable'' given a suitable mechanism. |
'''Wren-trait''' is a module which provides the abstract classes: Comparable, Cloneable and CloneableSeq. The first of these enables child classes to easily support the basic comparison operators and the latter two enables such classes to identify themselves as ''cloneable'' given a suitable mechanism. |
||
It also contains the wrapper classes: Stepped, Reversed, ByRef and ByKey. 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 |
It also contains the wrapper classes: Stepped, Reversed, Indexed, ByRef and ByKey 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. |
||
ByRef enables a value to be passed ''by reference'' to a method or function and ByKey enables a reference type object to be used as a Map key. |
|||
It is the fifth in a series of modules (listed on the language's [[https://rosettacode.org/wiki/Category:Wren 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. It is also small enough to be used by other modules in the series which are usually organized and written to avoid inter-dependencies. |
It is the fifth in a series of modules (listed on the language's [[https://rosettacode.org/wiki/Category:Wren 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. It is also small enough to be used by other modules in the series which are usually organized and written to avoid inter-dependencies. |
Revision as of 13:57, 1 September 2021
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-trait is a module which provides the abstract classes: Comparable, Cloneable and CloneableSeq. The first of these enables child classes to easily support the basic comparison operators and the latter two enables such classes to identify themselves as cloneable given a suitable mechanism.
It also contains the wrapper classes: Stepped, Reversed, Indexed, ByRef and ByKey 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.
ByRef enables a value to be passed by reference to a method or function and ByKey enables a reference type object to be used as a Map key.
It is the fifth 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. It is also small enough to be used by other modules in the series which are usually organized and written to avoid inter-dependencies.
To use it all you need to do is to copy the source code (in the [talk page]) to a text file called trait.wren and place this in the same directory as the importing script or module so the command line interpreter can find it.
Pages in category "Wren-trait"
The following 14 pages are in this category, out of 14 total.