Author |
Message |
Fogmeister
I haven't seen my friends in so long
Joined: Thu Apr 23, 2009 7:35 pm Posts: 6580 Location: Getting there
|
Just trying to work out what I think a logical/boolean expression should result in.
If a, b, c and d are all boolean values/expressions and I had an expression...
(a AND b) OR (c AND d)
then the expression is true if either a and b are both true or c and d are both true.
If I had the expression...
a AND (b OR c) AND d
then this would be true only if a and d are true and either of b or c (or both) is true.
But what if I had the expression...
a AND b OR c AND d
How would the expression work? Or would it depend on the language being used?
Purely a semantics question just out of interest.
Last edited by Fogmeister on Thu Mar 17, 2011 12:05 pm, edited 1 time in total.
|
Thu Mar 17, 2011 10:46 am |
|
 |
forquare1
I haven't seen my friends in so long
Joined: Thu Apr 23, 2009 6:36 pm Posts: 5150 Location: /dev/tty0
|
From the Boolean logic page on Wikipedia: So, would it be: (a AND b) or (c AND d) The expression is true if both a and b are true, OR if c and d are true.
|
Thu Mar 17, 2011 11:16 am |
|
 |
Fogmeister
I haven't seen my friends in so long
Joined: Thu Apr 23, 2009 7:35 pm Posts: 6580 Location: Getting there
|
|
Thu Mar 17, 2011 12:05 pm |
|
 |
finlay666
Spends far too much time on here
Joined: Thu Apr 23, 2009 9:40 pm Posts: 4876 Location: Newcastle
|
Easiest way is to use parenthesis as there is no penalty on excessive parenthesis usage (as it's stripped out during compilation anyway) and it aids in readability 
_________________TwitterCharlie Brooker: Macs are glorified Fisher-Price activity centres for adults; computers for scaredy cats too nervous to learn how proper computers work; computers for people who earnestly believe in feng shui.
|
Thu Mar 17, 2011 1:32 pm |
|
 |
Fogmeister
I haven't seen my friends in so long
Joined: Thu Apr 23, 2009 7:35 pm Posts: 6580 Location: Getting there
|
(((That)(')(s)) (my) (usual) (approach)(.))  But just came across a bit that didn't have any and wondered how it would work. I wrote a bit of code to try some values but just thought I'd ask aswell 
|
Thu Mar 17, 2011 2:15 pm |
|
 |
John_Vella
I haven't seen my friends in so long
Joined: Fri Apr 24, 2009 7:55 am Posts: 7935 Location: Manchester.
|
I agree! (.)(.) <-- For JJ  </Totally pointless post>
_________________John Vella BSc (Hons), PGCE - Still the official forum prankster and crude remarker  Sorry  I'll behave now. Promise 
|
Mon Mar 21, 2011 3:31 pm |
|
 |
Fogmeister
I haven't seen my friends in so long
Joined: Thu Apr 23, 2009 7:35 pm Posts: 6580 Location: Getting there
|
ROFL! I was wondering who would be the first person to do that  
|
Mon Mar 21, 2011 3:41 pm |
|
 |
EddArmitage
I haven't seen my friends in so long
Joined: Thu Apr 23, 2009 9:40 pm Posts: 5288 Location: ln -s /London ~
|
Yoshi peering through a letter box!
|
Mon Mar 21, 2011 4:31 pm |
|
 |
finlay666
Spends far too much time on here
Joined: Thu Apr 23, 2009 9:40 pm Posts: 4876 Location: Newcastle
|
I prefer ( , )( , ) <-- tassels/pasties 
_________________TwitterCharlie Brooker: Macs are glorified Fisher-Price activity centres for adults; computers for scaredy cats too nervous to learn how proper computers work; computers for people who earnestly believe in feng shui.
|
Mon Mar 21, 2011 4:44 pm |
|
 |
Fogmeister
I haven't seen my friends in so long
Joined: Thu Apr 23, 2009 7:35 pm Posts: 6580 Location: Getting there
|
Was trying to think of another one and discovered this version of Yoshi peering through a letter box... ( .Y. ) 
|
Mon Mar 21, 2011 10:52 pm |
|
 |
EddArmitage
I haven't seen my friends in so long
Joined: Thu Apr 23, 2009 9:40 pm Posts: 5288 Location: ln -s /London ~
|
Yeah. Me and Nick (Miners) have found quite a number. He's got a dirtier mind than me, though.
|
Mon Mar 21, 2011 11:03 pm |
|
 |
John_Vella
I haven't seen my friends in so long
Joined: Fri Apr 24, 2009 7:55 am Posts: 7935 Location: Manchester.
|
Leaking...? 
_________________John Vella BSc (Hons), PGCE - Still the official forum prankster and crude remarker  Sorry  I'll behave now. Promise 
|
Wed Mar 23, 2011 3:18 pm |
|
 |
finlay666
Spends far too much time on here
Joined: Thu Apr 23, 2009 9:40 pm Posts: 4876 Location: Newcastle
|
_________________TwitterCharlie Brooker: Macs are glorified Fisher-Price activity centres for adults; computers for scaredy cats too nervous to learn how proper computers work; computers for people who earnestly believe in feng shui.
|
Wed Mar 23, 2011 3:21 pm |
|
|