Suggestion of new program: execute mathematical set operations on lists
Hello everybody,
I am not yet looking for a sponsor, but going to program a tiny tool.
Because I am unexperienced and don’t want to do all the work for
nothing, first of all:
Is this tool senseful, is there a certain need for it? I am very
interested in your opinions, hoping that this list is the right place
for that.
And here it is: setop takes as inputs several lists/sets, calculates
desired (mathematical) set operations on them and outputs the final set
(or depending on operation resulting number of elements, answer yes/no,
…).
For example: File A contains 3 3 2 5 1 (each number an extra line). Then
setop A
would result in 1 2 3 5. This is equivalent to
sort | uniq
With a file B containing 5 90 2 7 the command
setop -i A B
would yield 2 5.
Here, -i stands for intersection. Of course, there is no limitation to
numbers, elements can be any non-empty strings.
Other operations are union, symmetric difference, difference, contains
element, is subset, cardinality and so on. As you can see on
<http://www.catonmat.net/blog/set-operations-in-unix-shell-simplified/>
nearly all these operations can already be done with other tools, but
the according command lines are mostly very tortuous. There doesn’t seem
to be a tool that directly works with sets.
I even exactly know what options setop (name ok?) should have and what
it can do (how it is used), but am waiting for some responses from you
before programming.
I would be very grateful for your feedback,
Frank
Reply to: