-
-
Notifications
You must be signed in to change notification settings - Fork 318
Open
Description
What new feature should Elvish have?
Sometimes, I want each to do something different if it sees no inputs at all, as in each $fn [] or put | each $fn. I suggest an optional argument named else, or perhaps if-none, for this.
To make the proposal clear, here is an elvish implementation.
fn each {|&else=$nil f @inputs|
if $else {
var none = $true
builtin:each {|item| set none = $false; $f $item } $@inputs
if $none { $else }
} else {
builtin:each $f $@inputs
} }
Oh, I almost forgot (since I hardly ever use it): Do the same for for.
Output of "elvish -version"
0.21.0-dev.0.20240809001233-bc247bb5e17c-dirty
Code of Conduct
- I agree to follow Elvish's Code of Conduct.
Metadata
Metadata
Assignees
Labels
No labels
Type
Projects
Status
❓Triage