It begs the question: did we search and find the answer of if-then-else, or did we find an answer that was sufficiently likeable and usable- but one of many possibilities? How do we know whether this choice was the global optimum vs a local one? Is if-then-else the electron- a deep truth waiting to be discovered- or the gasoline powered car- an option we explored for decades among others options.
If-then-else had to be invented
211–220 of 255 posts
Re: If-then-else had to be invented
#212Earlier quoted context omitted.
"(Women were present) and (children were present)"
How would you distribute "Jack and Jill play together."? If you start introducing prepositions, then your theory of "and"-expansion is going to get quite complex as it covers more and more cases.
Re: If-then-else had to be invented
#213I remember there was a paper that tried to compare natural language usage of common programming language keywords to see if they may come up with other constructs to create a programming language that is easier to learn as your first one. There were a few interesting observations. The one that stuck with me the most is that 'and' is most commonly used with almost the opposite sense in natural language vs programming:…
(((w ∨ c) → a) ↔ ((w → a) ∧ (c → a)))
That is, an implication whose antecedent is a disjunction is a conjunction of implications. On the other hand,
((a → (w ∨ c)) ↔ ((a → w) ∨ (a → c)))
That is, an implication whose consequent is a disjunction is a disjunction of implications.
Re: If-then-else had to be invented
#214Semi-related: Fortran has a where() and elsewhere() statement for applying a mask to part of an array. e.g., where (C/=0) A = B/C elsewhere A = 0.0 end It blew my mind the first time I saw it. I’d never seen else in anything but an if statement before.
https://stackoverflow.com/questions/9979970/why-does-python-...
Re: If-then-else had to be invented
#215Earlier quoted context omitted.
I was a linguistics major in college and therefore am a descriptivist, not a prescriptivist about language. When I say I cannot say this, I mean that this construct does not exist in the ordinary dialect that I speak, in the same way that I can say "that doesn't need washed" even though speakers of many other dialects have to say "washing" instead. If it is in someone else's dialect, they can feel free to say it, but…
> If it is in someone else's dialect, they can feel free to say it, but my experience is that it is rare. Agreed. And this is the reason why use of 'else' in programming languages might not have had to be invented, right?
Re: If-then-else had to be invented
#216Note also that when Microsoft put IF( , , , ) into Excel, the most widely used computing application in the world, they essentially used this syntax.
Re: If-then-else had to be invented
#217Chinese also has an interesting sentence structure that doesn't quite fit with European languages. In addition to subject.verb(object) form, there is also a kind of topic-comment form that might be reasonable to use in some assertion-like contexts. ensure(foo), !empty() require(bar), open() Chinese also has a word that can transform some kinds of statements into a question. `ma` is used to form yes-no questions. Imag…
In English, we have question and answer
Q: Where do you want to go for lunch?
A: I want to go to that pub for lunch.
In Chinese you'd say
Q: You want to go to ?? pub for lunch?
A: I want to go to that pub for lunch.
It even works for numbers, like
Q: It is ?? o'clock?
A: It is 7 o'clock.
Re: If-then-else had to be invented
#218Earlier quoted context omitted.
> If it is in someone else's dialect, they can feel free to say it, but my experience is that it is rare. Agreed. And this is the reason why use of 'else' in programming languages might not have had to be invented, right?
No. The article goes into great detail on this - if-else as a construct took a lot of iterations to finally appear in its current form. That fact is largely independent of how natural the word 'else' feels. If we used 'otherwise' instead of 'else', the control flow construct still wouldn't have been obvious.
Re: If-then-else had to be invented
#219I would think Soren Kierkegaard deserves a hat-tip to his existential work: Either/Or.
Re: If-then-else had to be invented
#220You can use "else" that way in ordinary speech. "If this then do that else do the other thing" is perfectly legitimate English, just a bit archaic.
I said I can't say it, not that no one can say it. It is not in my dialect.