Features and improvements to iterable objects #99
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
add the any, all and none Set methods, which
necessitate a dclone that can sometimes be
preferred over conversion to an Array
.any, .all, and .none on Set and Array can be
called without a block, like map
Block: new constants, IDENTITY and LIST_IDENTITY
which return their argument or arguments,
respectively, to lessen runtime overhead for
these tiny but common callables.
User code can construct these with Block.identity
and Block.list_identity.
Array: use the IDENTITY block if a method that
wants a block, wasn't called with one.
This eliminates some runtime overhead for
nested loops, and cleans up the code with
fewer immediate anonymous subs that can
introduce typos.
add the Hash.linear_selection method, which
creates a Hash that is a subset of a hash,
given an iterable argument of keys
linear_selection, useful on its own, is used
to implement Set-like operations on Hashes,
with Sets, Hashes, Arrays, and other iterables
on the RHS.
Now it's possible to intersect, difference,
union and symdiff Hashes with other objects.
These operate primarily on the Hashes' keys.
Last, Set.difference is extended to allow a
Hash on the RHS, for subtracting a Hash's
keys from a Set without needing to iterate
it twice.