What do coom and diff try to accomplish at input/output level?
Clash Royale CLAN TAG#URR8PPP
up vote
0
down vote
favorite
In mathematics, a set doesn't impose order between its elements.
"S1-S2", the set difference operation on two sets S1 and S2, results in a set of the elements in the first operand set but not in the second.
When taking the intersection of two sets, if an element is considered in both sets, it doesn't matter where it appears in the two sets.
Similar operations to set difference exist on files, such as comm
from coreutils and diff
from diffutils. But we can't think of a file as a set of lines, but as an ordered set of lines, because the lines are ordered.
Moreover, comm
and diff
also work differently from each other.
What do comm
and diff
try to accomplish at concept level (at input and output level) respectively? If you can also use mathematics to explain, that might be clearer (I suspect I may need some basic knowledge on ordered sets). I don't expect an explanation at their implementation level, but that may help.
Specifically, how do they determine whether
- a line exists in both input files, and its occurrences are the same.
- a line exists in both input files, but its occurrences differ
- a line exists in one file but not the other
- a line exists in the other file but not this file.
Thanks.
text-processing diff version-control math comm
add a comment |Â
up vote
0
down vote
favorite
In mathematics, a set doesn't impose order between its elements.
"S1-S2", the set difference operation on two sets S1 and S2, results in a set of the elements in the first operand set but not in the second.
When taking the intersection of two sets, if an element is considered in both sets, it doesn't matter where it appears in the two sets.
Similar operations to set difference exist on files, such as comm
from coreutils and diff
from diffutils. But we can't think of a file as a set of lines, but as an ordered set of lines, because the lines are ordered.
Moreover, comm
and diff
also work differently from each other.
What do comm
and diff
try to accomplish at concept level (at input and output level) respectively? If you can also use mathematics to explain, that might be clearer (I suspect I may need some basic knowledge on ordered sets). I don't expect an explanation at their implementation level, but that may help.
Specifically, how do they determine whether
- a line exists in both input files, and its occurrences are the same.
- a line exists in both input files, but its occurrences differ
- a line exists in one file but not the other
- a line exists in the other file but not this file.
Thanks.
text-processing diff version-control math comm
1
With diff, it might be easier to start with the concept of a patch. A patch is a mathematical operation on a file. The diff command then asks, what patch will convert the first file into the second? So, diff is the inverse of patch. Edit: also, you have a typo in the title, comm -> coom ;)
â cryptarch
2 mins ago
Have you tried studying the source code? This is a detailed question, but have you done any research on your own? If you want definitive knowledge, look at the source code; if approximations are acceptable, have you tried any reverse engineering?
â Wildcard
54 secs ago
@cry I get the idea of "diff" means subtraction of one file from the other. But at the line level, how does it make decision on each line?
â Tim
40 secs ago
add a comment |Â
up vote
0
down vote
favorite
up vote
0
down vote
favorite
In mathematics, a set doesn't impose order between its elements.
"S1-S2", the set difference operation on two sets S1 and S2, results in a set of the elements in the first operand set but not in the second.
When taking the intersection of two sets, if an element is considered in both sets, it doesn't matter where it appears in the two sets.
Similar operations to set difference exist on files, such as comm
from coreutils and diff
from diffutils. But we can't think of a file as a set of lines, but as an ordered set of lines, because the lines are ordered.
Moreover, comm
and diff
also work differently from each other.
What do comm
and diff
try to accomplish at concept level (at input and output level) respectively? If you can also use mathematics to explain, that might be clearer (I suspect I may need some basic knowledge on ordered sets). I don't expect an explanation at their implementation level, but that may help.
Specifically, how do they determine whether
- a line exists in both input files, and its occurrences are the same.
- a line exists in both input files, but its occurrences differ
- a line exists in one file but not the other
- a line exists in the other file but not this file.
Thanks.
text-processing diff version-control math comm
In mathematics, a set doesn't impose order between its elements.
"S1-S2", the set difference operation on two sets S1 and S2, results in a set of the elements in the first operand set but not in the second.
When taking the intersection of two sets, if an element is considered in both sets, it doesn't matter where it appears in the two sets.
Similar operations to set difference exist on files, such as comm
from coreutils and diff
from diffutils. But we can't think of a file as a set of lines, but as an ordered set of lines, because the lines are ordered.
Moreover, comm
and diff
also work differently from each other.
What do comm
and diff
try to accomplish at concept level (at input and output level) respectively? If you can also use mathematics to explain, that might be clearer (I suspect I may need some basic knowledge on ordered sets). I don't expect an explanation at their implementation level, but that may help.
Specifically, how do they determine whether
- a line exists in both input files, and its occurrences are the same.
- a line exists in both input files, but its occurrences differ
- a line exists in one file but not the other
- a line exists in the other file but not this file.
Thanks.
text-processing diff version-control math comm
text-processing diff version-control math comm
edited 1 min ago
asked 15 mins ago
Tim
24.7k70239428
24.7k70239428
1
With diff, it might be easier to start with the concept of a patch. A patch is a mathematical operation on a file. The diff command then asks, what patch will convert the first file into the second? So, diff is the inverse of patch. Edit: also, you have a typo in the title, comm -> coom ;)
â cryptarch
2 mins ago
Have you tried studying the source code? This is a detailed question, but have you done any research on your own? If you want definitive knowledge, look at the source code; if approximations are acceptable, have you tried any reverse engineering?
â Wildcard
54 secs ago
@cry I get the idea of "diff" means subtraction of one file from the other. But at the line level, how does it make decision on each line?
â Tim
40 secs ago
add a comment |Â
1
With diff, it might be easier to start with the concept of a patch. A patch is a mathematical operation on a file. The diff command then asks, what patch will convert the first file into the second? So, diff is the inverse of patch. Edit: also, you have a typo in the title, comm -> coom ;)
â cryptarch
2 mins ago
Have you tried studying the source code? This is a detailed question, but have you done any research on your own? If you want definitive knowledge, look at the source code; if approximations are acceptable, have you tried any reverse engineering?
â Wildcard
54 secs ago
@cry I get the idea of "diff" means subtraction of one file from the other. But at the line level, how does it make decision on each line?
â Tim
40 secs ago
1
1
With diff, it might be easier to start with the concept of a patch. A patch is a mathematical operation on a file. The diff command then asks, what patch will convert the first file into the second? So, diff is the inverse of patch. Edit: also, you have a typo in the title, comm -> coom ;)
â cryptarch
2 mins ago
With diff, it might be easier to start with the concept of a patch. A patch is a mathematical operation on a file. The diff command then asks, what patch will convert the first file into the second? So, diff is the inverse of patch. Edit: also, you have a typo in the title, comm -> coom ;)
â cryptarch
2 mins ago
Have you tried studying the source code? This is a detailed question, but have you done any research on your own? If you want definitive knowledge, look at the source code; if approximations are acceptable, have you tried any reverse engineering?
â Wildcard
54 secs ago
Have you tried studying the source code? This is a detailed question, but have you done any research on your own? If you want definitive knowledge, look at the source code; if approximations are acceptable, have you tried any reverse engineering?
â Wildcard
54 secs ago
@cry I get the idea of "diff" means subtraction of one file from the other. But at the line level, how does it make decision on each line?
â Tim
40 secs ago
@cry I get the idea of "diff" means subtraction of one file from the other. But at the line level, how does it make decision on each line?
â Tim
40 secs ago
add a comment |Â
active
oldest
votes
active
oldest
votes
active
oldest
votes
active
oldest
votes
active
oldest
votes
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
StackExchange.ready(
function ()
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2funix.stackexchange.com%2fquestions%2f480457%2fwhat-do-coom-and-diff-try-to-accomplish-at-input-output-level%23new-answer', 'question_page');
);
Post as a guest
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
1
With diff, it might be easier to start with the concept of a patch. A patch is a mathematical operation on a file. The diff command then asks, what patch will convert the first file into the second? So, diff is the inverse of patch. Edit: also, you have a typo in the title, comm -> coom ;)
â cryptarch
2 mins ago
Have you tried studying the source code? This is a detailed question, but have you done any research on your own? If you want definitive knowledge, look at the source code; if approximations are acceptable, have you tried any reverse engineering?
â Wildcard
54 secs ago
@cry I get the idea of "diff" means subtraction of one file from the other. But at the line level, how does it make decision on each line?
â Tim
40 secs ago