Zsh Mailing List Archive
Messages sorted by:
Reverse Date,
Date,
Thread,
Author
Re: array-=$value ?
- X-seq: zsh-workers 22637
- From: Bart Schaefer <schaefer@xxxxxxxxxxxxxxxx>
- To: Zsh-Workers <zsh-workers@xxxxxxxxxx>
- Subject: Re: array-=$value ?
- Date: Sun, 20 Aug 2006 09:16:12 -0700
- In-reply-to: <20060820132847.GC27688@xxxxxxxxxxxxxxxxxxxxxxxxxxx>
- Mailing-list: contact zsh-workers-help@xxxxxxxxxx; run by ezmlm
- References: <20060820070150.GB27688@xxxxxxxxxxxxxxxxxxxxxxxxxxx> <20060820132847.GC27688@xxxxxxxxxxxxxxxxxxxxxxxxxxx>
On Aug 20, 3:28pm, Matthias Kopfermann wrote:
}
} Am Sonntag, dem 20. August 2006 um 09:01 Uhr, Matthias Kopfermann:
} > A question i was not able to answer myself:
} > array=( a b c d e)
} > array+=f # works
} > array-=a # does not work, but why exactly?
}
} Ah, I guess, it's because then it should really delete the
} last value and then in this case -=a would do something non
} obvious to stay analogue to +=d.
Right. As another example, suppose the element "a" appears more than
once in the array. Should -= mean array[(r)a]=() or array[(R)a]=() or
array=(${array:#a}) ?
And what would array-=(e a c) mean? Most obvious would be that it maps
the operator over the argument, I guess, but that's not the only choice.
Have you noticed that array[2]+=(x y z) splices the new elements into
the array between positions 2 and 3? Describe array[2]-=(x y z).
Messages sorted by:
Reverse Date,
Date,
Thread,
Author