OR and XOR

A place to discuss the science of computers and programs, from algorithms to computability.

Formal proofs preferred.

Moderators: phlip, Moderators General, Prelates

User avatar
Cartofel
Posts: 28
Joined: Mon May 05, 2008 3:51 pm UTC

OR and XOR

Postby Cartofel » Tue Nov 25, 2008 12:30 pm UTC

Hi,

I'm posting this here because I don't think it would fit in Coding... Apologies if this has been dissected here many times before...

When I started programming, one of the first things that bugged me (and which didn't seem to be language-specific) was the way OR and XOR are used. In Boolean algebra, the function of OR is called disjunction (which is given the + sign, as that pretty much describes what it does) -- if any or both of the two values is true, their disjunction is is true. So, basically, the only time you can get a false out of a disjunction is if both values are false. XOR is eXclusive OR (or parity in Boolean algebra, given a + in a circle), in that if both values are true their parity is false (I suppose the exclusive part is because the values have to be mutually exclusive).

Now, this is the bit that gets my beef (as a linguist who programs as well) -- I don't think that the conjunction "or" describes disjunction.
Take, for example, this question:

"Would you like cake or ice cream?"

What could your possible answers be? Obviously, "Cake, please" or "Ice cream, please", or words to that effect. Would you expect someone to say, "Both!"? Personally, I would think that that person was breaking the rules, or something. (I remember at a party I was at once, when someone did something similar, someone else said, "What? It's cake or ice cream!", which I think proves my point.) I think that if your host wanted to offer that choice, they would probably say,

"Would you like cake, or ice cream, or both?"

This might only be true for speakers of UK English, but I think not -- have you noticed how common the ugly "and/or" is in legal texts? Doesn't this imply that "or" by itself wouldn't mean that both were an option? (I've also seen this in French texts, where they seem to use "et/ou" in exactly the same way.)

I think that, in fact, "or" as it is used in actual English is really parity, and that the real alien idea is the non-exclusive (can we please say "inclusive", before my eyes start bleeding?) version of "or". So maybe we should have OR for parity, and something like IOR (Inclusive OR) for disjunction.

So... yeah. Thanks for your time...

EDIT: Terminological urk
Thus spake Cartofel.
And yea, there were great rollings of eyes, and shakings of heads.

Spoiler:
I've actually never listened to any Hard-Fi

User avatar
Moo
Oh man! I'm going to be so rebellious! I'm gonna...
Posts: 6432
Joined: Thu Aug 16, 2007 3:15 pm UTC
Location: Beyond the goblin city
Contact:

Re: OR and XOR

Postby Moo » Tue Nov 25, 2008 12:44 pm UTC

"This function is true if x is true or y is true".

When you phrase it this way there is no ambiguity. The problem is that you are relying on words subject to various interpretations and meanings; words that rely on context to make sense because they are language words, and not bound by the same logic as mathematics.

"Would you like cake or ice cream" implies an exclusivity. If you were allowed both things you might not be offered it in that way. Think of it this way: in English, or is a broad term that can be used for either a Boolean or or xor, depending on context or further clarification.

edit:

Wrt the "and/or", it is to cover legal asses because of the way "or" can be interpreted to mean both "or" or "xor", and legal and other important texts need to eliminate any potential ambiguity.

Which, I suppose, is kind of what the OP is saying, that he dislikes this possible ambiguity; but I'm afraid that is what language is. And rightly so. Without ambiguity you couldn't make puns, entendres or "that's what she said" jokes! We've relied on context and intonation to add meaning beyond words long before Boolean algebra was formalised. I am curious whether this problem has been solved in Lobjan?
Last edited by Moo on Tue Nov 25, 2008 1:07 pm UTC, edited 1 time in total.
Proverbs 9:7-8 wrote:Anyone who rebukes a mocker will get an insult in return. Anyone who corrects the wicked will get hurt. So don't bother correcting mockers; they will only hate you.
Hawknc wrote:FFT: I didn't realise Proverbs 9:7-8 was the first recorded instance of "haters gonna hate"

Koboldskind
Posts: 15
Joined: Wed May 02, 2007 10:34 am UTC

Re: OR and XOR

Postby Koboldskind » Tue Nov 25, 2008 1:00 pm UTC

I don't think the "or" in natural language necessarily implies exclusivity, at least in englishi feel it strongly depends on intonation. (I say feel here because i'm relying on my language intuition, not on any rules that I am aware of):

To the sentence "Would you like cake or icecream?" with the standard intonation for a question, "Both, actually" appears to be a perfectly valid, if maybe impolite, answer. (=> logical OR)

If you change it to "Would you like CAKE or ICECREAM?" with an emphasis on the 2 desserts in question (think the way the flight attendant on a plane would ask), then the speaker expects you to make an either-or choice. (=> logical XOR)

Please excuse me if that example is nonsense, I am not a native english speaker, but this at least is my perception.

So it boils down to (as always) logical expression not really mapping well into natural language, because spoken natural language transports much more information than just the semantic content of a phrase.

User avatar
thornahawk
Posts: 64
Joined: Wed Oct 29, 2008 3:56 am UTC
Location: somewhere out in the SEA
Contact:

Re: OR and XOR

Postby thornahawk » Tue Nov 25, 2008 3:43 pm UTC

Wrt the "and/or", it is to cover legal asses because of the way "or" can be interpreted to mean both "or" or "xor", and legal and other important texts need to eliminate any potential ambiguity.


Reminds me... I had just put down my copy of Strunk and White:

The Elements of Style wrote:And/or. A device, or shortcut, that damages a sentence and often leads to confusion or ambiguity.


Harsh. :o "___ or ___ or both" is what they recommend.

Anyway, I always relied on intonation to distinguish between the two uses of OR that English has given it. More often than not it was meant as the inclusive.

~ Werner
John Dolan wrote:Cigarettes are insanely expensive and turn lots of poor people into cringing beggars.


E-mail!

stephentyrone
Posts: 778
Joined: Mon Aug 11, 2008 10:58 pm UTC
Location: Palo Alto, CA

Re: OR and XOR

Postby stephentyrone » Tue Nov 25, 2008 3:54 pm UTC

Linguistically the idea is that "or" really does, semantically, mean inclusive-or, but when people mean "both", they use a conjunction instead, from which we can often infer that people are using "or" exclusively (because they would have said "and" if they meant both, which is simpler).

This sort of pragmatic reasoning, "the sentence is ambiguous, but if they intended meaning B, they would have said it in a different, simpler way, so they must have intended meaning A," has a name in linguistics, but it's early in the morning, so I'm blanking on it.

I'm also blanking on the standard examples used in intro linguistics classes to show people that "or" really is inclusive. Try posting in the the linguistics forum, someone there will remember these things =)
GENERATION -16 + 31i: The first time you see this, copy it into your sig on any forum. Square it, and then add i to the generation.

Rysto
Posts: 1460
Joined: Wed Mar 21, 2007 4:07 am UTC

Re: OR and XOR

Postby Rysto » Tue Nov 25, 2008 3:57 pm UTC

There are plenty of instances in English where inclusive or is intended. For example, 'I drive to work when it is raining or it's below 5 degrees Celcius outside'.

If it's raining and the temperature is 1 degree, does he drive to work? Of course he does.

EternalVortex
Posts: 1
Joined: Sat Nov 22, 2008 2:02 am UTC

Re: OR and XOR

Postby EternalVortex » Wed Nov 26, 2008 3:09 am UTC

Inclusive or is common in English. For example, "the grass is wet if it rains or the sprinker is on".

However, I don't believe any sentence in English uses the exclusive or, because no sentence in English is false if both parts are true.

User avatar
quintopia
Posts: 2906
Joined: Fri Nov 17, 2006 2:53 am UTC
Location: atlanta, ga

Re: OR and XOR

Postby quintopia » Wed Nov 26, 2008 4:44 am UTC

EternalVortex wrote:However, I don't believe any sentence in English uses the exclusive or, because no sentence in English is false if both parts are true.


Sometimes in English "either" or "one of" are used to select the exclusive or. But it's still possible to have an exclusive or without them.

For instance: This car comes in red, black, or white.

It is not meant that the car comes in red AND black, so the statement would be false if there existed a model that was both red and black.

User avatar
Berengal
Superabacus Mystic of the First Rank
Posts: 2707
Joined: Thu May 24, 2007 5:51 am UTC
Location: Bergen, Norway
Contact:

Re: OR and XOR

Postby Berengal » Wed Nov 26, 2008 5:06 am UTC

Iterestingly, "this car comes in red or white" can mean the same as "this car comes in red and white." Both can be interpreted as "this car comes in either red or white but not both." (Both can also be interpreted to mean different things.)
It is practically impossible to teach good programming to students who are motivated by money: As potential programmers they are mentally mutilated beyond hope of regeneration.

User avatar
evilbeanfiend
Posts: 2650
Joined: Tue Mar 13, 2007 7:05 am UTC
Location: the old world

Re: OR and XOR

Postby evilbeanfiend » Wed Nov 26, 2008 8:31 am UTC

iirc latin has seperate words for exclusive or and inclusive or, its just an english thing.
in ur beanz makin u eveel

User avatar
Cartofel
Posts: 28
Joined: Mon May 05, 2008 3:51 pm UTC

Re: OR and XOR

Postby Cartofel » Wed Nov 26, 2008 3:53 pm UTC

evilbeanfiend wrote:iirc latin has seperate words for exclusive or and inclusive or, its just an english thing.

habet "aut" et "vel", nescio qualem discrepantiam esse.
(io!)
Thus spake Cartofel.
And yea, there were great rollings of eyes, and shakings of heads.

Spoiler:
I've actually never listened to any Hard-Fi

User avatar
roc314
Is dead, and you have killed him
Posts: 1356
Joined: Thu Jul 24, 2008 12:48 am UTC
Location: A bunker, here behind my wall
Contact:

Re: OR and XOR

Postby roc314 » Wed Nov 26, 2008 8:40 pm UTC

quintopia wrote:
EternalVortex wrote:However, I don't believe any sentence in English uses the exclusive or, because no sentence in English is false if both parts are true.


Sometimes in English "either" or "one of" are used to select the exclusive or. But it's still possible to have an exclusive or without them.

For instance: This car comes in red, black, or white.
If this was a logical xor, then one of the possible choices would be red and black and white (xor is true if an odd number of the choices are true--not only 1 (check the truth tables)).

Usually the colloquial exclusive or in English speech means "one (and not more) of the following". If there are only two choices, then this is equivalent to the logical xor.
Hippo: roc is the good little communist that lurks in us all
Richard Stallman: Geeks like to think that they can ignore politics, you can leave politics alone, but politics won't leave you alone.
suffer-cait: roc's a pretty cool dude

User avatar
Dingbats
Posts: 921
Joined: Tue Mar 20, 2007 12:46 pm UTC
Location: Sweden
Contact:

Re: OR and XOR

Postby Dingbats » Wed Nov 26, 2008 9:47 pm UTC

evilbeanfiend wrote:iirc latin has seperate words for exclusive or and inclusive or, its just an english thing.

The way you put it it sounds like English is unique in having an ambiguous "or". I don't have any statistics at hand, but I find it pretty likely that the majority of all languages has ambiguous "or" at least as an option.

User avatar
thornahawk
Posts: 64
Joined: Wed Oct 29, 2008 3:56 am UTC
Location: somewhere out in the SEA
Contact:

Re: OR and XOR

Postby thornahawk » Thu Nov 27, 2008 10:22 am UTC

Cartofel wrote:
evilbeanfiend wrote:iirc latin has seperate words for exclusive or and inclusive or, its just an english thing.

habet "aut" et "vel", nescio qualem discrepantiam esse.
(io!)


N.B. "vel" is why the symbol sometimes encountered for logical OR is [imath]a\vee b[/imath] . ;) As for "aut"...

~ Werner
John Dolan wrote:Cigarettes are insanely expensive and turn lots of poor people into cringing beggars.


E-mail!

User avatar
quintopia
Posts: 2906
Joined: Fri Nov 17, 2006 2:53 am UTC
Location: atlanta, ga

Re: OR and XOR

Postby quintopia » Mon Dec 01, 2008 5:52 pm UTC

roc314 wrote:
quintopia wrote:
EternalVortex wrote:However, I don't believe any sentence in English uses the exclusive or, because no sentence in English is false if both parts are true.


Sometimes in English "either" or "one of" are used to select the exclusive or. But it's still possible to have an exclusive or without them.

For instance: This car comes in red, black, or white.
If this was a logical xor, then one of the possible choices would be red and black and white (xor is true if an odd number of the choices are true--not only 1 (check the truth tables)).


I can't find my trinary logic tables right now, but I'm pretty sure that a trinary xor works out to mean one (and not more) is true(1) or true(2). Notice that I wrote "red, white, or black," not "(red or white) or black," clearly indicating my use of trinary logic. [/snark]

User avatar
roc314
Is dead, and you have killed him
Posts: 1356
Joined: Thu Jul 24, 2008 12:48 am UTC
Location: A bunker, here behind my wall
Contact:

Re: OR and XOR

Postby roc314 » Mon Dec 01, 2008 7:07 pm UTC

quintopia wrote:I can't find my trinary logic tables right now, but I'm pretty sure that a trinary xor works out to mean one (and not more) is true(1) or true(2). Notice that I wrote "red, white, or black," not "(red or white) or black," clearly indicating my use of trinary logic. [/snark]
Point taken, but I was pointing out that xor is just as vague as or. Unless it's made obvious which xor is being used, it's confuses the meaning. The clearest way to express the idea of "one and only" is to say "one and only one". Or, xor, etc. are too easily confused.
Hippo: roc is the good little communist that lurks in us all
Richard Stallman: Geeks like to think that they can ignore politics, you can leave politics alone, but politics won't leave you alone.
suffer-cait: roc's a pretty cool dude

User avatar
Berengal
Superabacus Mystic of the First Rank
Posts: 2707
Joined: Thu May 24, 2007 5:51 am UTC
Location: Bergen, Norway
Contact:

Re: OR and XOR

Postby Berengal » Tue Dec 02, 2008 3:33 pm UTC

You wouldn't use xor in an unclear context. A car salesman, no matter how well versed in logic, and knowing that I too know logic, would never say "This car comes in xor(blue, yellow, red)". Usually when we're using xor, it's a predicate that takes exactly two terms, so xor(blue, red, yellow) would not compute, and this should be pretty clear from context. Note that trinary xor also only takes two terms, but those terms may evaluate to one of three values, not just two.
Xor for multiple arguments does exist, and it's defined as true iff an odd number of arguments are true. Since xor is associative, "xor(a, b, c)" is the the same as "a xor b xor c", so the arity 2 one is pretty much all we need.
It is practically impossible to teach good programming to students who are motivated by money: As potential programmers they are mentally mutilated beyond hope of regeneration.

User avatar
quintopia
Posts: 2906
Joined: Fri Nov 17, 2006 2:53 am UTC
Location: atlanta, ga

Re: OR and XOR

Postby quintopia » Tue Dec 02, 2008 6:06 pm UTC

And I think we just crossed the point of taking this stuff way too seriously

User avatar
DubioserKerl
Posts: 71
Joined: Sat Jun 07, 2008 8:23 am UTC

Re: OR and XOR

Postby DubioserKerl » Wed Dec 03, 2008 8:39 am UTC

Koboldskind wrote:To the sentence "Would you like cake or icecream?" with the standard intonation for a question, "Both, actually" appears to be a perfectly valid, if maybe impolite, answer. (=> logical OR)

If you change it to "Would you like CAKE or ICECREAM?" with an emphasis on the 2 desserts in question (think the way the flight attendant on a plane would ask), then the speaker expects you to make an either-or choice. (=> logical XOR)



Actually, if you used the "or" and "xor" in the language just like in logic, the only valid answers could be "true" and "false"; represented by "yes" and "no".

So, the answer to "Would you like cake or icecream" would be "yes", if the logical "or" is implied and you want at least one of the deserts. The answer would be "no" if you use the "xor" semantics and actually want both. If you answer "yes" to a xor-choice, no one would know what desert you want until it is clarified by additional information.

Now please (flame XOR praise) me. ;-)
Image

User avatar
Grop
Posts: 1994
Joined: Mon Oct 06, 2008 10:36 am UTC
Location: France

Re: OR and XOR

Postby Grop » Thu Dec 04, 2008 5:06 pm UTC

There was an interesting article on Language Log about or being always exclusive or not. The examples given are funny and convincing.

sakeniwefu
Posts: 170
Joined: Sun May 11, 2008 8:36 pm UTC

Re: OR and XOR

Postby sakeniwefu » Tue Dec 09, 2008 12:03 pm UTC

DubioserKerl wrote:If you answer "yes" to a xor-choice, no one would know what desert you want until it is clarified by additional information.


They would know that you don't want both nor none.
Additionally, If you replied true to binary "or" and "xor" you would get either an icecream cake or a sugarless cake with ice topping.

User avatar
aleflamedyud
wants your cookies
Posts: 3307
Joined: Tue Oct 09, 2007 7:50 pm UTC
Location: The Central Bureaucracy

Re: OR and XOR

Postby aleflamedyud » Sun Dec 14, 2008 3:13 am UTC

DubioserKerl wrote:
Koboldskind wrote:To the sentence "Would you like cake or icecream?" with the standard intonation for a question, "Both, actually" appears to be a perfectly valid, if maybe impolite, answer. (=> logical OR)

If you change it to "Would you like CAKE or ICECREAM?" with an emphasis on the 2 desserts in question (think the way the flight attendant on a plane would ask), then the speaker expects you to make an either-or choice. (=> logical XOR)



Actually, if you used the "or" and "xor" in the language just like in logic, the only valid answers could be "true" and "false"; represented by "yes" and "no".

So, the answer to "Would you like cake or icecream" would be "yes", if the logical "or" is implied and you want at least one of the deserts. The answer would be "no" if you use the "xor" semantics and actually want both. If you answer "yes" to a xor-choice, no one would know what desert you want until it is clarified by additional information.

Now please (flame XOR praise) me. ;-)

When it comes to deserts I personally prefer Arrakis.
"With kindness comes naïveté. Courage becomes foolhardiness. And dedication has no reward. If you can't accept any of that, you are not fit to be a graduate student."

Shadowpawn
Posts: 16
Joined: Tue Dec 30, 2008 1:48 am UTC

Re: OR and XOR

Postby Shadowpawn » Thu Jan 01, 2009 6:33 am UTC

Berengal wrote:Iterestingly, "this car comes in red or white" can mean the same as "this car comes in red and white." Both can be interpreted as "this car comes in either red or white but not both." (Both can also be interpreted to mean different things.)


No, if the car salesmen is saying "this car comes in red and white" and he means "or" then it simply means he made a logical error. In proper English "and" should NEVER be used in place of "or".

Goplat
Posts: 490
Joined: Sun Mar 04, 2007 11:41 pm UTC

Re: OR and XOR

Postby Goplat » Thu Jan 01, 2009 4:18 pm UTC

Cartofel wrote:I don't think that the conjunction "or" describes disjunction.
Take, for example, this question:

"Would you like cake or ice cream?"
Here "or" is just being used to delimit a list of choices. It is not being used as any kind of logical operator, because if it were the question would be yes-or-no.

When "or" is used as a logical operator in English, as far as I know it is always inclusive.

monroetransfer
Posts: 26
Joined: Wed Aug 27, 2008 1:03 am UTC

Re: OR and XOR

Postby monroetransfer » Mon Jan 26, 2009 1:58 am UTC

OR: would you like cake or ice-cream?
XOR: would you like cake, or ice-cream?

User avatar
poirelli
Posts: 33
Joined: Sun Dec 28, 2008 5:00 am UTC

Re: OR and XOR

Postby poirelli » Mon Jan 26, 2009 3:30 am UTC

Nobody offers cake or ice cream anyway.

It's always: "Would you like cake and ice cream?"

or perhaps "How much cake and ice cream would you like?"

User avatar
Qoppa
Posts: 694
Joined: Sat Nov 24, 2007 9:32 pm UTC
Location: Yes.

Re: OR and XOR

Postby Qoppa » Mon Jan 26, 2009 3:38 am UTC

I haven't read the thread, but this entire discussion is rather ridiculous. Or in natural language is not in one-to-one correspondence with either the logical OR or XOR. The entire idea of representing English with formal logic won't work due to pragmatic factors. You'll always be able to find exceptions to any would-be rule you can come up with.

Code: Select all

_=0,w=-1,(*t)(int,int);a()??<char*p="[gd\
~/d~/\\b\x7F\177l*~/~djal{x}h!\005h";(++w
<033)?(putchar((*t)(w??(p:>,w?_:0XD)),a()
):0;%>O(x,l)??<_='['/7;{return!(x%(_-11))
?x??'l:x^(1+ ++l);}??>main(){t=&O;w=a();}

User avatar
Quizatzhaderac
Posts: 1780
Joined: Sun Oct 19, 2008 5:28 pm UTC
Location: Space Florida

Re: OR and XOR

Postby Quizatzhaderac » Sat Jan 31, 2009 10:00 pm UTC

Shadowpawn wrote:
Berengal wrote:Iterestingly, "this car comes in red or white" can mean the same as "this car comes in red and white." Both can be interpreted as "this car comes in either red or white but not both." (Both can also be interpreted to mean different things.)


No, if the car salesmen is saying "this car comes in red and white" and he means "or" then it simply means he made a logical error. In proper English "and" should NEVER be used in place of "or".

In that case the "and sentase and "or" sentanses actually are syntatically different, but both valid under descriptive rules of english.

It is worth emphasisng is that "This car" does not refer to an indivual car in this context, but a catagory of cars which "this one" exemplifies (probably the year + make). If taken literally you'd obviously just look at the car in front of you.

The "and" sentanse is bascially saying: "This car can come in red, and this car can come in white" Reffering to the catagory.

While the "or" sentanse is saying: "I can sell you this car having paint of the colors red xor white" Reffering to any member of the catagory.
The thing about recursion problems is that they tend to contain other recursion problems.

monroetransfer
Posts: 26
Joined: Wed Aug 27, 2008 1:03 am UTC

Re: OR and XOR

Postby monroetransfer » Sun Feb 01, 2009 12:16 am UTC

Qoppa wrote:I haven't read the thread, but this entire discussion is rather ridiculous. Or in natural language is not in one-to-one correspondence with either the logical OR or XOR. The entire idea of representing English with formal logic won't work due to pragmatic factors. You'll always be able to find exceptions to any would-be rule you can come up with.


this.

akashra
Posts: 503
Joined: Tue Jan 01, 2008 6:54 am UTC
Location: Melbourne, AU
Contact:

Re: OR and XOR

Postby akashra » Wed Feb 18, 2009 11:38 pm UTC

monroetransfer wrote:OR: would you like cake or ice-cream?
XOR: would you like cake, or ice-cream?

I agree with this.

Of course the alternative is that we all start going around asking things like "would you like cake xor ice-cream?"
( find / -name \*base\* -exec chown us : us { } \ ; )

User avatar
quintopia
Posts: 2906
Joined: Fri Nov 17, 2006 2:53 am UTC
Location: atlanta, ga

Re: OR and XOR

Postby quintopia » Thu Feb 19, 2009 2:25 am UTC

akashra wrote:
monroetransfer wrote:OR: would you like cake or ice-cream?
XOR: would you like cake, or ice-cream?

I agree with this.

Of course the alternative is that we all start going around asking things like "would you like cake xor ice-cream?"


This is what I would say if someone had just answered the standard version with "yes."

akashra
Posts: 503
Joined: Tue Jan 01, 2008 6:54 am UTC
Location: Melbourne, AU
Contact:

Re: OR and XOR

Postby akashra » Thu Feb 19, 2009 2:33 am UTC

quintopia wrote:This is what I would say if someone had just answered the standard version with "yes."


Yeah. See, I'm the kind of smart-ass that when asked "Would you like cake or ice-cream" would answer "yes". It's like asking "do you know the time?".
You need to be specific, people. Lawyers hate people like us though, so that's a plus :)
( find / -name \*base\* -exec chown us : us { } \ ; )

User avatar
Quizatzhaderac
Posts: 1780
Joined: Sun Oct 19, 2008 5:28 pm UTC
Location: Space Florida

Re: OR and XOR

Postby Quizatzhaderac » Thu Feb 19, 2009 3:19 pm UTC

akashra wrote:It's like asking "do you know the time?".
You need to be specific, people. Lawyers hate people like us though, so that's a plus :)


Another fun example is "Do you know how to get to <place>?" versus "How do you get to <place>?" If someone just asks the second I'l always give them precise directions, regarless if the answer to the first question was yes or no.
The thing about recursion problems is that they tend to contain other recursion problems.

User avatar
Berengal
Superabacus Mystic of the First Rank
Posts: 2707
Joined: Thu May 24, 2007 5:51 am UTC
Location: Bergen, Norway
Contact:

Re: OR and XOR

Postby Berengal » Thu Feb 19, 2009 3:59 pm UTC

Quizatzhaderac wrote:
akashra wrote:It's like asking "do you know the time?".
You need to be specific, people. Lawyers hate people like us though, so that's a plus :)


Another fun example is "Do you know how to get to <place>?" versus "How do you get to <place>?" If someone just asks the second I'l always give them precise directions, regarless if the answer to the first question was yes or no.

My friend always gives "precise" direction, even if they asked the first question AND the answer is no.
It is practically impossible to teach good programming to students who are motivated by money: As potential programmers they are mentally mutilated beyond hope of regeneration.

User avatar
'; DROP DATABASE;--
Posts: 3284
Joined: Thu Nov 22, 2007 9:38 am UTC
Location: Midwest Alberta, where it's STILL snowy
Contact:

Re: OR and XOR

Postby '; DROP DATABASE;-- » Fri Mar 06, 2009 6:31 am UTC

Obviously the solution here is to start a motion to make "xor" a word. Then you can simply ask "would you like cake xor ice cream?"
poxic wrote:You suck. And simultaneously rock. I think you've invented a new state of being.

Vempele
Posts: 69
Joined: Wed Nov 14, 2007 8:05 am UTC

Re: OR and XOR

Postby Vempele » Fri Mar 06, 2009 3:57 pm UTC

'; DROP DATABASE;-- wrote:Obviously the solution here is to start a motion to make "xor" a word. Then you can simply ask "would you like cake xor ice cream?"
"Yes, I would like one of {cake, ice cream}."
"Um... Okay, here's some cake."
"No, thank you."

We also need a new word that asks for the truth values of all the the subexpressions of the expression it's applied to. Or a word that asks that the other person please not be a jerk. :)

"Multiwould you like cake xor ice cream?"
"True {false, true}."
const int ALMOST_FIFTY = 80;

Random832
Posts: 2525
Joined: Wed Oct 10, 2007 4:38 pm UTC

Re: OR and XOR

Postby Random832 » Fri Mar 06, 2009 6:04 pm UTC

Vempele wrote:
'; DROP DATABASE;-- wrote:Obviously the solution here is to start a motion to make "xor" a word. Then you can simply ask "would you like cake xor ice cream?"
"Yes, I would like one of {cake, ice cream}."
"Um... Okay, here's some cake."
"No, thank you."

We also need a new word that asks for the truth values of all the the subexpressions of the expression it's applied to. Or a word that asks that the other person please not be a jerk. :)

"Multiwould you like cake xor ice cream?"
"True {false, true}."


select top up-to(1) from (cake, ice cream) order by preference as to whether you would like to have it right now.

User avatar
Berengal
Superabacus Mystic of the First Rank
Posts: 2707
Joined: Thu May 24, 2007 5:51 am UTC
Location: Bergen, Norway
Contact:

Re: OR and XOR

Postby Berengal » Fri Mar 06, 2009 8:52 pm UTC

That's doomed to produce a type error on a runtime that doesn't know about the type Desert's instance witnesses in the classes Ord and Num...
It is practically impossible to teach good programming to students who are motivated by money: As potential programmers they are mentally mutilated beyond hope of regeneration.

VDOgamez
Posts: 122
Joined: Tue May 06, 2008 1:49 am UTC

Re: OR and XOR

Postby VDOgamez » Wed Mar 11, 2009 2:14 pm UTC

Slightly off topic, or possibly back on topic...

I once spent an entire day treating the word "or" the same way you treat it in logic. For example: "Are you riding the bus home or are you being picked up?" "Yes." The problem, I realized, is that that response will often make people assume the latter, so it could make you miss your bus here.

I got two detentions and a lot of bad words. :mrgreen:


Return to “Computer Science”

Who is online

Users browsing this forum: No registered users and 5 guests