codethesaur.us
codethesaur.us copied to clipboard
Clarify operand placement in language definitions of math operators
Language
Likely all of them
Wrong Field(s)
Most languages usually use something along the lines of the operator in between two operands (i.e. a + b
). Not all languages do, notably something like LISP does (+ a b)
.
There are also prefix and postfix operators that might get confusing if people don't understand what prefix and postfix are. (As in what's the difference between ++
and ++
when we really mean ++a
and a++
?)
This would be to go through the languages and add in operators to them. Likely most of them are standard infix ones (a + b
) except prefix/postfix above. For languages that differ, I can help catch it in PR.
This probably means doing something like:
"addition_operator": "operand1 + operand2"
(or something else like a + b
to make it understandable and thorough).
Additional notes
Check out the documentation at https://docs.codethesaur.us if you need additional help or ask any questions you might have.
I can work on it . Please assign to me.
Great, I'll add you!
If you have any questions, let me know. And feel free to read the documentation if you need any help!
#include
Oh no, you're overthinking it!
For example, take https://github.com/codethesaurus/codethesaur.us/blob/117b77a54b8b203ac99a2a74d61d006fe8ca02d7/web/thesauruses/cpp/C%2B%2B20/operators.json#L9L12 :
Change:
"code": "+",
to
"code": "operand1 + operand2",
That's all. Make it obvious the order of the operators relative to the operands. Don't add any extra code (like functions, includes, etc.) unless for some reason you need it (like Java needs an import to do exponents). Definitely don't write a full program for it!
This is just to clarify something like C++ (a + b
) vs LISP ((+ a b)
) or other languages where order may not be obvious. Same for like C++'s prefix increment (++a
) vs C++'s postfix increment (a++
).
Does this help explain a little better?
"concepts": { "addition": { "code": "+", "name": "Addition operator" "code": "operand1 + operand2" }, just like this only? will I do for all operator?
If I am thinking in right way then tell me I will give you the all solution tomorrow.
So you won't change anything in the file BUT the code
lines. If you change the rest of the file, it won't work right.
You'll only be adding operands to the code
lines. Don't add extra lines, just change/edit them.
And yes, the issue is to do it for all operators in all files in /web/thesauruses/[language]
.
If this is too much for a first-time contributor, I understand and you can take another issue or back out of this one if you want!
Operand1=a; Operand2=b; "code": "+" "code": "a+b" //Sum is Operand1 + Operand2
Do either:
"code": "operand1 + operand2"
or
"code": "a + b"
Not both, and don't try adding extra things into it. You are just adding operands into the existing code lines.
"code": "+" "code": "a+b" //Sum of two number So this is correct?
Hmm... I'm not sure how to really clear this up any more than I've already tried.
Can you go ahead and make a few changes you think are right, then make a pull request. We can then look at them in there and hopefully clear it up. Then you can do the changes everywhere.
Does that sound good?
Here, I also made an example:
The left side are the original lines (with changes in red). The right side is the modified side (with changes in green). This issue is to only modify the code
lines to add in operand variables.
- "meta":`` {
-
"language": "cpp",
-
"language_version": "C++20",
-
"language_name": "C++",
-
"structure": "operators"
- },
- "concepts": {
-
"addition": {
-
"code": "operand1 + operand2",
-
"name": "Addition operator"
-
},
-
"addition_assignment": {
-
"code": "result+=operand1",
-
"name": "Addition and assignment operator"
-
},
-
"subtraction": {
-
"code": "operand1 - operand2",
-
"name": "Subtraction operator"
-
},
-
"subtraction_assignment": {
-
"code": "result -= operand1",
-
"name": "Subtraction and assignment operator"
-
},
-
"multiplication": {
-
"code": "operand1 * operand2",
-
"name": "Multiplication operator"
-
},
-
"multiplication_assignment": {
-
"code": "result *= operand1",
-
"name": "Multiplication and assignment operator"
-
},
-
"division": {
-
"code": "operand1 / operand2",
-
"name": "Division operator"
-
},
-
"division_assignment": {
-
"code": "result /= operand1",
-
"name": "Division and assignment operator"
-
},
-
"modulus": {
-
"code": "operand1 % operand2",
-
"name": "Modulus (remainder) operator"
-
},
-
"modulus_assignment": {
-
"code": "result %= operand",
-
"name": "Modulus and assignment operator"
-
},
-
"increment": {
-
"comment": "There are two types of increment: pre-increment (++x) and post-increment (x++). ",
-
"code": "operand1++ or operand1 = operand1+1",
-
"name": "Increment (add 1) operator"
-
},
-
"decrement": {
-
"comment": "There are two types of decrement: pre-decrement (--x) and post-decrement (x--). ",
-
"code": "operand1-- or operand1 = operand1 - 1",
-
"name": "Decrement (subtract 1) operator"
-
},
-
"equal_to": {
-
"code": "==",
-
"name": "Equality operator"
-
},
-
"not_equal_to": {
-
"code": "!=",
-
"name": "Not equal to operator"
-
},
-
"less_than": {
-
"code": "operand1< operand2",// operand1 is less than operand2
-
"name": "Less than operator"
-
},
-
"less_than_or_equal_to": {
-
"code": "operand1 <= operand2 ",//operand1 is less than or equal to operand2
-
"name": "Less than or equal to operator"
-
},
-
"greater_than": {
-
"code": "operand1 > operand2", //operand1 is greater than operand2
-
"name": "Greater than operator"
-
},
-
"greater_than_or_equal_to": {
-
"code": "operand1 >= operand2 ",//operand1 is less than or equal to operand2
-
"name": "Greater than or equal to operator"
-
}
.. sorry to late . so is this correct or I have do more modification in this
Yeah, basically! Go ahead and make a pull request with that and I can point more specifically to a couple of things.
I didn't get it yet and tell me also that upper comment error and what type of changes and what type of new things which I have to add
I'm not sure if I understand what you mean by "I didn't get it yet" and the upper comment error.
If this issue is too confusing, you're welcome to back out, or to pick a different issue to work on.
I am new user on github so please tell me , now what I have to do
Are you familiar with git and how to commit code? If not, you might want to find a tutorial, video, or something on how to do that.
The next step is to make a pull request. You can read directions about that on GitHub's documentation site.
At that point, you will have saved your code, stored it on GitHub, then made a pull request, which will compare your changes to what exists in Code Thesaurus now. I can then look at those changes and make suggestions, and we can validate that they work and the project builds.
Hey can I work on implementing this in the Python and JavaScript folders?
Hey @Rishav-12, I think that would be good to help divide up the work! I'll assign you too.
There's examples of what I'm looking for with this issue above. There's also the documentation site too. If you have other questions, let me know!
Hey @geekygirlsarah, I just pushed some changes to the Python folder. I shall continue working on the JavaScript folder and push further changes
That works! You can mark it as a "draft" pull request if you're not done but it can keep it there if you want.
@Neeraj8949 If you look at pull request #556, you'll see how @Rishav-12 made the changes. Do you think you can do that for other languages?
@Rishav-12 do you want to take on any other languages?
Both of you: I can also split this out into separate issues for all the languages if you want to have a smaller issue.
This issue has been inactive for 356 hours (14.83 days) and will be unassigned after 52 more hours (2.17 days). If you have questions, please visit leave a message or let @geekygirlsarah know by Twitter or email.
If you are still working on this issue, that's fine. Please comment here to tell the bot to give you more time.
This issue has been inactive for 428 hours (17.83 days) and is past the limit of 408 hours (17.00 days) so is being unassigned.You’ve just been unassigned from this ticket due to inactivity – but feel free to pick it back up (or a new one!) in the future! Thank you again for your contribution to this project.