Zsh Mailing List Archive
Messages sorted by:
Re: Set difference between sets of files
- X-seq: zsh-users 14104
- From: Phil Pennock <zsh-workers+phil.pennock@xxxxxxxxxxxx>
- To: "Benjamin R. Haskell" <zsh@xxxxxxxxxx>
- Subject: Re: Set difference between sets of files
- Date: Wed, 6 May 2009 11:45:54 -0700
- Cc: Zsh Users <zsh-users@xxxxxxxxxx>
- Domainkey-signature: a=rsa-sha1; q=dns; c=nofws; s=d200902; d=spodhuis.org; h=Received:Date:From:To:Cc:Subject:Message-ID:Mail-Followup-To:References:MIME-Version:Content-Type:Content-Disposition:In-Reply-To; b=vOmFKQH0dt9Or1AOOgB6p5FAT++SmudlowM86CARNbkDbQQg1zzBG1cwyOuuuSBne1QV5zXRLekmh+kfQ2MjeL1qTt7Jx68Mm6rG8igQbrg2xR/YiaXb/o4D8nwxHmgl38l0UByO2/daNPgQDC9z0s71Yi3a71jJ95BOniIj1PI=;
- In-reply-to: <alpine.LNX.2.00.0905060000380.17577@averatec>
- Mail-followup-to: "Benjamin R. Haskell" <zsh@xxxxxxxxxx>, Zsh Users <zsh-users@xxxxxxxxxx>
- Mailing-list: contact zsh-users-help@xxxxxxxxxx; run by ezmlm
- References: <94de1b620905050936g442490e4t3da42ac3946cb29@xxxxxxxxxxxxxx> <20090505235845.GA68298@xxxxxxxxxxxxxxxxxxxx> <alpine.LNX.2.00.0905060000380.17577@averatec>
On 2009-05-06 at 00:17 -0400, Benjamin R. Haskell wrote:
> Am I missing something, or isn't this the canonical case for using
> associative arrays?
Sets can be implemented using associative arrays, sure. But zsh also
has auto-unique linear arrays and the functions I provided wrap up the
set manipulation safely (I believe) and concisely.
For sets of a few thousand items (or sometimes an order of magnitude
more), where I can have several such sets at once, to find intersections
and differences, my understanding is that the lists use less memory.
In any case, the posted functions work for me and avoid my having to
cut&paste results of shell commands into a python interpreter.
Obviously, this is always dealing with exceptional situations, since
normal situations are covered with more robust scripts with unittests,
etc, but sometimes life just gets interesting and zsh is there to help
Messages sorted by: