Earlier quoted context omitted.
I shouldn't speculate I guess. :) Als sounds like a cognate to else, but maybe it's not related. Looking up etymology for "else", I see it comes from old High German's "elles". https://en.wiktionary.org/wiki/else#Etymology > „falls“ for „if“ This one is interesting in the same way that it might lead me to the wrong conclusion. Is 'falls' related to 'falsch' at all? The English 'falls' is used quite differently, thoug…
> Is 'falls' related to 'falsch' at all? Nope, according to Kluge's German etymological dictionary, "falls" is from a Germanic root most literally meaning falling (down) (just like English "fall"), while "falsch" is borrowed from Latin falsus, which in turn comes from the Latin verb fallere, to deceive (like "fallacy"). (Wiktionary also traces the two of them to different Indo-European roots.) There's an interesting…
If-then-else had to be invented
221–230 of 255 posts
Re: If-then-else had to be invented
#222It 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.
In regards to global vs local optimum it is useful to look at the alternatives like pattern matching. For languages that don't support pattern matching or passing in functions as values, "if" is probably the best you can do with. You might be able to do something with boolean short-circuit operators but it's debatable if that that is better than the if statement. In React, if you are using JSX, they don't have "if" s…
Coming from a non-pattern marching language (python) I’ve yet to see what the big deal is, maybe you can help.
I can have as many elif’s as I need cases and other than maybe not needing to repeat `x==...` I’m not sure what I’m missing out on.
With that being said, I do often wish for more elegant solutions to long winded if else
Re: If-then-else had to be invented
#223I 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:…
well, sometimes it can be syntactically ambiguous too, right?
e.g. "I welcome big and small dogs" vs "I welcome well-behaved and properly groomed dogs"
Re: If-then-else had to be invented
#224Re: If-then-else had to be invented
#225I would love to read something similar about a "for" loop. "if/else" always sounded natural to me, but a "for" to mean a loop never did.
Re: If-then-else had to be invented
#226Earlier quoted context omitted.
You’ve framed it in the article and here again as a correctness issue, but it’s not a correctness issue. It’s fair to say you haven’t heard it, or that it’s uncommon today, but if you use it, it’s not wrong. And people will understand you, even if you do get a sideways glance from some people. You can use “else” without “or”, if you like. The article was fascinating, especially the historical examples from different…
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…
3.a. In another case, under other circumstances; otherwise, on any other supposition; if not. Now usually preceded by or: see or else at or conj.1 6.
a1225 (c1200) Vices & Virtues (1888) 27 (MED) All ȝelief ðu fastliche, elles ðu, ne namann ne mai bien ȝeboreȝen. a1375 (c1350) William of Palerne (1867) l. 1647 (MED) Foule þow me fodest wiþ þi faire wordes, elles had i deide for duel. 1570 T. Tusser Hundreth Good Pointes Husbandry (new ed.) f. 19 Where Iuie embraceth the tree very sore, kill Iuie, or tree else will adle no more. 1590 E. Spenser Faerie Queene i. i. sig. A5v Strangle her, els she sure will strangle thee. 1837 J. H. Newman Parochial Serm. (ed. 3) I. v. 115 Else how should any one be saved? 1873 R. Browning Red Cotton Night-cap Country ii. 115 Boughs above, Darken, deform the path, else sun would streak. 1938 H. L. Mencken Diary 10 Aug. (1989) 112 Black has told friends that this indicates to him that Reed must be a trimmer, else he would not be favored by all parties. 2013 L. Powell Witch Fire xvii. 155 Shut up, else I'll only make it worse for you. Both of you.
And here are a few citations I found by searching at Project Gutenberg:
They were, in fact, beatified bees, who had to be solemnly invited to attend the death mass when the owner died, else they would fly away, refusing to stay.
https://www.gutenberg.org/files/14036/14036-h/14036-h.htm
“now, I hope, my trial is ended; else its length will be, as in some other cases, the worst of punishments.”
https://www.gutenberg.org/files/9414/9414-h/9414-h.htm
It is absolutely necessary that the plate be chemically clean all over, else the film of collodion, upon drying, will split, and the negative be spoilt.
Re: If-then-else had to be invented
#227Earlier quoted context omitted.
If you say it out loud, you will realize that the question "Do you want to eat pizza or pasta?" (exclusive-or case with the answer "pizza" or "pasta," i.e. in the sense "these are your two choices, which would you prefer?") is an entirely different utterance from "Do you want to eat pizza or pasta?" (inclusive-or case with the answer "yes" or "no," i.e. in the sense "would you like to go to an Italian restaurant?").…
Do you want to eat pizza and garlic bread? - inclusive Do you want to eat pizza or garlic bread? - exclusive In natural language "and" works like a inclusive or. If there is pizza and garlic bread I can choose to eat one or both. Or is always exclusive in this sentence.
Do you want to eat some pizza or some garlic bread? - probably inclusive or
Also, I would interpret the first question as "addition" (pizza with garlic bread, on the model of mac and cheese), not as an inclusive or.
Re: If-then-else had to be invented
#228I 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:…
That's something that array languages did right.
Re: If-then-else had to be invented
#229Earlier quoted context omitted.
What is wrong with a yes response to "do you want to eat pizza or pasta?" with yes implying that one would be willing to eat either rather than requiring an exclusive preference that could be asked with "either" before pizza? Similarly with the boy or girl question, "no" may be stillborn.
> What is wrong with a yes response to "do you want to eat pizza or pasta?" It doesn't answer the question. The questioner is asking for your help in making a decision. If you are completely neutral about the two, then most people answer with the phrase, "Either one is fine". Saying just "yes" sounds like you misunderstood the question --- unless you say it with a wry smile, showing that you mean to be funny in your…
> > Similarly with the boy or girl question, "no" may be stillborn.
> The sex is set at conception.
Not necessarily - at conception, the cells could be XX, XY, but also XXY (not to mention, they could be X- or -Y). After conception, chymerism could occur, where XX and XY twins become conjoined and a single fetus develops having both XX and XY chromosomes in different parts of the body - the sex will mostly be determined by which DNA is used when forming the gonads. It could also end up developing both kinds of gonads. But even if the fetus develops testicles, there is a chance that it has some kind of testosterone resistance and ends up with a completely female phenotype. Of course, there is also a possibility that no gonads are developed. This is all staying well in the realm of biological sex, and disregarding other hormonal complications that could happen based on what the mother is doing and her health, and disregarding any morphological abnormalities that could cause surface-level confusion between biologically male and female sexual organs.
Re: If-then-else had to be invented
#230Earlier quoted context omitted.
"This is of course related to why the famous joke "Is it a boy or a girl? Yes." is so hilarious" Only to IT people though. Common folks will just look at you in a weird way...
Except the folks are mathematicians. But in this case there is actually a slight chance that nobody recognizes this as a joke at all...
But I figured most mathematicians are IT people, too. But there is at least also a third group: philisophers. They have formal logic, too (in university), but seldom math.
So in the spirit of the joke:
"Only to IT people though. "
Would have to be:
"Only to IT people and/or math people and/or philosophers, though. "
Desire for formal correctness satisfied?