Try removing extra paren from one of the expressions in
and see if you can find any problem after removal.
Try removing extra paren from one of the expressions in
and see if you can find any problem after removal.
I like it so far. Iâve played it for a few hours so far. Iâve beaten twenty-two levels so far. I think Iâm learning something? I do like the stuff with âisâ and âandâ. Iâll keep playing it. I havenât been playing many games recently so Iâll probably play this a bit.
Toki Tori was fun. I played the first 5 levels so far and it seems interesting. I might play it more, I donât know. Right now Iâm enjoying baba is you a lot more.
Before:
nor(or(x,y),or(or((or(x,z)),and(((not(x)),not((and(x,y))), or(or(x,z), z))
After:
nor(or(x,y), or(or(or(x,z),and(not(x), not(and(x,y)), or(or(x,z), z))
Hmm. That still makes sense. I still think the two sets of two double parentheses I have are necessary. I think it helps clear up what the second and third âorâ operators from the left are working on.
nor(or(x,y), or(or(or(x,z),and(not(x), not(and(x,y), or(or(x,z), z)
Without them the third âorâ operator from the left seems to be working on âor(or(x,z), zâ. Which it shouldnât. Or maybe Iâm reading this wrong?
I think youâre reading it wrong. After an operator and an open parenthesis, you have to figure out which close parenthesis ends the operatorâs inputs.
The rule is the first close parenthesis unless you reach any more open parenthesis, in which case they have to be closed first. The more recent, more nested open paren take priority on matching with close paren.
Ok Iâm getting a bit confused.
So hereâs the expression:
nor(or(x,y), or(or(or(x,z),and(not(x), not(and(x,y), or(or(x,z), z)
Hereâs what you said:
So going through this:
nor(or(x,y), or(or(or(x,z),and(not(x), not(and(x,y), or(or(x,z), z)
I have a parentheses closing off or(x,y), or(x,z), not(x), and(x,y), or(x,z).
Donât I need âextraâ closing brackets to show what the second or, third or, and fifth or are working on?
What do you mean by âextraâ? You should have one set of parentheses per operator. Previously you had more but in this post you donât have more than that.
Both of these are incorrect.
With all notations, the number of open paren should equal the number of close paren.
If you count these, youâll find the numbers donât match.
With prefix notation, the number of open paren should also equal the number of operators, and there shouldnât be 2 open paren in a row, because each open paren goes immediately after an operator (or immediately before for s-expressions).
Besides making sure the counts are correct, you can also draw arrows from every open paren to the close paren it goes with and make sure everything makes sense and encloses the correct stuff. You can also use color coding or multiple lines with indentation to show what goes in what paren.
I understand for those two now, sure. Isnât this incorrect, too?
I count 17 parentheses.
11 open
6 closed.
I think Iâm beginning to understand what youâre saying. I just want to make sure this one is incorrect also before I proceed. You never directly told me if this was one was correct or not. I just assumed it was correct.
Yes itâs also incorrect.
How did you get uneven numbers of parentheses?
1.) nor(or(x,y),or(or((or(x,z)),and(((not(x)),not((and(x,y))), or(or(x,z), z))
open paren - 15
close paren - 11
total paren - 26
Ok. I was missing 4 closing paren for this one.
2.) nor(or(x,y), or(or(or(x,z),and(not(x), not(and(x,y)), or(or(x,z), z))
open paren - 11
close paren - 6
total paren - 17
Ok. I was missing 4 closing paren for this one.
number of operators = 11
So 22 total paren, 11 close, 11 open.
I kinda just realized what you meant by the extra paren. So when it come to this expression:
I got it by only leaving one paren where there multiple paren in my original expression. So:
Has ((or(x,z)). I turned it into (or(x,z) or (((not(x)), not((and(x,y))) became (not(x), not(and(x,y). I didnât get what you meant by extra so I just thought I just had too many parenâs in my expression (like that it looked cluttered or something),but now that I think about it I donât think I was too clear in my understanding on what the parenâs were doing.
What do paren do?
Show what an operator is specifically working on. So:
or(x,y)
The parenâs are making it clear that the only things getting orâd are x and y. Hmm. A better example is maybe this:
and(or(x,y), z) vs. and or x y z
The first one says you are trying to use âandâ on âor(x,y)â and âzâ. The second one is unclear on what is being worked on. Is âandâ working on all three? Or is âorâ working on all three and I have a one input âandâ. Itâs not too clear.
It helps clarify what is grouped together to be worked on by an operator.
OK. Do you think you understand this stuff and your problem is fixed? Do you want to move on or work on parentheses more? Note: Understanding them correctly is very important.
I think I understand this and my problem is fixed. Mmm, Since you say theyâre very important I donât mind working on them a bit more to make sure I really do understand this.
OK find a few things online with a bunch of parentheses and draw arrows from open each paren to the matching close paren.
you have at least one error