PowerShell / PowerShell/PowerShell
Negative Array/String Multiplication (Easy Reverse)
Nobody has claimed this yet.
- Dominant language
- C#
- Stars
- 55.5k
- Forks
- 8.5k
- Avg merge
- 1d 2h
- Merged PRs (30d)
- 88
Description
Summary of the new feature / enhancement
As a PowerShell user and developer, I often want to reverse an array or string.
As a developer who has been using array multiplication to pretty great effect in Turtle, I think it would be extraordinarily geometrically interesting to be able to reverse and repeat a range of steps in a single statement.
It would also provide a shorter way to reverse a list within a single expression (currently, one has to declare the array and then call [Array]::Reverse, which returns nothing). This benefit of simplicity would also extend to strings.
Proposed technical implementation details (optional)
PowerShell already supports array multiplication of a positive number. It should be fairly trivial to support array multiplication of a negative number as well: simply create a reversed copy and then duplicate that array.
Proposed syntax:
1,2,3 * 2 # will produce 1,2,3,1,2,3
1,2,3 * -2 # should produce 3,2,1,3,2,1
This would also open up easy "reverse iteration", without ranges
# Get a list of files in the current folder in reverse order
foreach ($file in @(Get-ChildItem -Path . -File) * -1) {
$file
}
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
The issue names no source files, tests, or entry points. Start by reproducing the existing positive array-multiplication examples, then trace where multiplication semantics are handled. Done means negative multiplication reverses and repeats arrays and strings as shown, including reverse iteration behavior.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- powershell
- Domain
- cli
- Issue type
- Feature
- Difficulty
- 5/5
- Estimated time
- Over a week
- Activity status
- Stale
- Clarity
- Clearly specified
- Newbie friendliness
- 35/100