settheory(1f) - [M_sets:SETTHEORY] combine two sets of values and display union, intersection, values found in both sets, values found only in one set, ... (LICENSE:MIT)
Synopsis
Description
Options
Results
Examples
See Also
settheory -a SET_ONE -b SET_TWO [--type DATATYPE] [--setorder ORDERTYPE] [--verbose]
settheory(1f) finds the union, intersection, and set differences of two small sets of numbers or strings and displays themIf both sets are empty a simple example is run.
--seta,-a SET_ONE vector of numbers or strings comprising set A. May be delimited by commas, spaces, or colons. If spaces are used the set needs quoted. --setb,-b SET_TWO vector of numbers or strings comprising set B. May be delimited by commas, spaces, or colons. If spaces are used the set needs quoted. --type,-t DATATYPE May be "integer", "character", "real" or "double". Defaults to "character". --setorder,-o ORDERTYPE "sorted" or "stable". If "stable" the values remain in the order input. --verbose,-V add additional descriptive text --usage,-u show table of options and their current values --version,-v Print version information on standard output then exit successfully. --help,-h Print usage information on standard output then exit successfully.
Outputs the results from the following calls to the M_set(3f) module
o unique(A,setOrder);unique(B,setOrder) - Unique values in each array o union(A,B,setOrder) - Set union of two arrays o intersect(A,B,setOrder) - Set intersection of two arrays o setdiff(A,B,setOrder) - Set difference of two arrays o ismember(A,B) - Array elements of set B that are members of set A array o setxor(A,B,setOrder) - Set exclusive OR of two arrays
Sample commands
settheory -a one,two,three -b four,two,five,three A : one two three B : four two five three UNIQUE A : one three two UNIQUE B : five four three two UNION : five four one three two INTERSECT : three two SETDIFF : one ISMEMBER : 0 1 1 SETXOR : five four onesettheory -a 7,23,14,15,9,12,8,24,35 -b 2,5,7,8,14,16,25,35,27 \ --type integer A : 7 23 14 15 9 12 8 24 35 B : 2 5 7 8 14 16 25 35 27 UNIQUE A : 7 8 9 12 14 15 23 24 35 UNIQUE B : 2 5 7 8 14 16 25 27 35 UNION : 2 5 7 8 9 12 14 15 16 23 24 25 27 35 INTERSECT : 7 8 14 35 SETDIFF : 9 12 15 23 24 ISMEMBER : 1 0 1 0 0 0 1 0 1 SETXOR : 2 5 9 12 15 16 23 24 25 27 # or settheory --type integer \ -a 7 23 14 15 9 12 8 24 35 \ -b 2 5 7 8 14 16 25 35 27 # or settheory --type integer \ -a 7:23:14:15:9:12:8:24:35 \ -b 2:5:7:8:14:16:25:35:27
diff(1),uniq(1),sort(1),comm(1),join(1)
Nemo Release 3.1 | settheory (1) | February 23, 2025 |