From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 29449 invoked from network); 9 Aug 1998 11:54:16 -0000 Received: from math.gatech.edu (list@130.207.146.50) by ns1.primenet.com.au with SMTP; 9 Aug 1998 11:54:16 -0000 Received: (from list@localhost) by math.gatech.edu (8.9.1/8.9.1) id HAA27939; Sun, 9 Aug 1998 07:40:49 -0400 (EDT) Resent-Date: Sun, 9 Aug 1998 07:40:39 -0400 (EDT) From: "Bart Schaefer" Message-Id: <980809044123.ZM19065@candle.brasslantern.com> Date: Sun, 9 Aug 1998 04:41:23 -0700 In-Reply-To: <19980809025636.18149@astaroth.nit.gwu.edu> Comments: In reply to Sweth Chandramouli "sorting/uniq-ing an array?" (Aug 9, 2:56am) References: <19980809025636.18149@astaroth.nit.gwu.edu> X-Mailer: Z-Mail (4.0b.820 20aug96) To: Sweth Chandramouli , ZSH Users Subject: Re: sorting/uniq-ing an array? MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Resent-Message-ID: <"njTgq1.0.3q6.sgOpr"@math> Resent-From: zsh-users@math.gatech.edu X-Mailing-List: archive/latest/1710 X-Loop: zsh-users@math.gatech.edu X-Loop: zsh-workers@math.gatech.edu Precedence: list Resent-Sender: zsh-workers-request@math.gatech.edu On Aug 9, 2:56am, Sweth Chandramouli wrote: : Subject: sorting/uniq-ing an array? : : i've come up with a way : to remove redundant entries from an array (the appropriate part of : my .zshrc is at the end of this message), but it's very slow : : is there a faster way to do this? Yes; typeset -U ports but the completion code makes its internal list of completions unique, so it doesn't really help to remove the redundant entries from arrays in advance when using them only for completion. : (as always, of course, comments on style are also appreciated. : i'm fairly certain that i still don't understand when ${= is needed : and when it isn't, so i just tend to use it everywhere that splitting : might be needed. did i do it right here?) You almost never need ${=...} when the "..." refers to an array. Using ${=...} on an array causes the individual elements of the array to be split into words, which is not very often what is wanted. So no, you didn't do it right here: : portnames=("${${${(f)$(