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

Re: Set difference between sets of files



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
me.



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