Zsh Mailing List Archive
Messages sorted by: Reverse Date, Date, Thread, Author

Re: PATCH: Explain array append a bit better



On Thu, Dec 4, 2014 at 5:51 AM, Bart Schaefer <schaefer@xxxxxxxxxxxxxxxx> wrote:
> My apologies if this is a duplicate, I was in the middle of sending it
> when my desktop box briefly lost contact with the UPS due to a USB
> error and decided that this meant power was failing and it needed to
> shut down.  I don't see it in the archives so I presume it didn't go.
>
> This moves the description of the "+=" assignment up to the intro where
> other assignments are discussed, and explains "appending" to associative
> arrays.

Should we perhaps mention array prepending somewhere too? I read the
sections "Array Subscripts" and "Array Element Assignment", and
searched for the string 1,0 and came up with nothing.

diff --git i/Doc/Zsh/params.yo w/Doc/Zsh/params.yo
index 5833d6b..cd09d70 100644
--- i/Doc/Zsh/params.yo
+++ w/Doc/Zsh/params.yo
@@ -99,6 +99,11 @@ the syntax:
 ifzman()
 indent(var(name)tt(+=LPAR())var(value) ...tt(RPAR()))

+To prepend to an array, use the syntax (requires that tt(KSH_ARRAYS)
+and tt(KSH_ZERO_SUBSCRIPT) are not set):
+ifzman()
+indent(var(name)tt([)var(1,0)tt(]=LPAR())var(value) ...tt(RPAR()))
+
 Ordinary array parameters may also be explicitly declared with:
 findex(typeset, use of)
 ifzman()


-- 
Mikael Magnusson



Messages sorted by: Reverse Date, Date, Thread, Author