Live data from Hacker News

If-then-else had to be invented

github.com

141–150 of 255 posts

Re: If-then-else had to be invented

#141
post #8

Earlier quoted context omitted.

Wiktionary has a usage example from 1903, clearly before modern computers but not too ancient. > 1903, Jack London, The Call of the Wild, Grosset & Dunlap, page 44: > […] and his first experience taught him an unforgetable lesson. It is true, it was a vicarious experience, else he would not have lived to profit by it. As an aside there is at least one common word which does seem to have been invented by the software…

> "access" as a verb But is it pronounced the same way? I stress the first or the second vowel depending on the case.

That's interesting, what accent do you have? In American English I've only ever heard them pronounced the same in noun or verb form.

Re: If-then-else had to be invented

#142
post #63

Earlier quoted context omitted.

The word “and” in English is simply there to join multiple clauses together. Whether it is a set union or set intersection, (or some other relations) depends on the sentence. Set union: they can read and write’ Set intersection: my jeans were creased and dirty Sequential: he turned round and walked out Causal: there was a flash flood and by the next morning the town was under water’ And, there are many more usages.

It's surprising how often you can replace 'but' with 'and' in a sentence.

Why is that surprising? They have exactly the same meaning; the difference is that 'but' additionally carries information about the subjective point of view of the speaker. (Where 'and' indicates that two things are true, 'but' indicates that (1) two things are true; and (2) the speaker considers this surprising or anticipates that the listener might find it surprising.)

Re: If-then-else had to be invented

#143

Interesting timing. I just read https://arstechnica.com/?post_type=post&p=1728174 due to r/programming https://www.reddit.com/r/programming/comments/kbs11a/a_damn_... yesterday. Apparently Cambridge Programming Language (more or less a failed language that became proto-C) designer Christopher Strachey had some misgivings about this usage of "else".

Looks like this article was the source of the Twitter thread https://twitter.com/geoffwozniak/status/1337916048276852737 where I revived the discussion of my talk.

Re: If-then-else had to be invented

#144

Earlier quoted context omitted.

> "access" as a verb But is it pronounced the same way? I stress the first or the second vowel depending on the case.

That's interesting, what accent do you have? In American English I've only ever heard them pronounced the same in noun or verb form.

For me english is mostly a written language, as I speak it very rarely. I think that I speak with a mix of french and spanish accents, incorrectly stressing the last syllables of many words, and pronouncing different vowels using the same sound.

Re: If-then-else had to be invented

#145

If the question is, what was the first programming language that introduced "If-then-else" then the read makes sense, but I'm not sure if was really an inventive step. In propositional logic, which was developed well before the first computers by Leibniz, Frege, Boole, De Morgan, etc.: "If A then B else C" can be stated as: (A --> B) ^ (¬A --> C) So, in patent/invention language, I'm not sure if it would really const…

[deleted]

Re: If-then-else had to be invented

#146
post #130

Earlier quoted context omitted.

I am the author, and I mean that I can say "or else" in a normal sentence, but I cannot say "else" without an "or" in normal speech in my normal dialect.

Wouldn't it be fair to say that it's just a shortened version of "or else"? Just like most programming languages skip "then" in "if ... then" even though it's often required for the sentence to look natural.

Algol was not prone to abbreviation. Algol 58 used "or if," so if they had wanted "or else," they would have used "or else."

Re: If-then-else had to be invented

#147
post #130

Earlier quoted context omitted.

I am the author, and I mean that I can say "or else" in a normal sentence, but I cannot say "else" without an "or" in normal speech in my normal dialect.

Maybe not in your dialect of English, but what about older dialects? "Pay for your beer. Else, leave this place at once!"

This is a usage that I have no memory of ever encountering in any context other than computer programming. It may be in some dialects, but not in ones I have come in conscious contact with.

Re: If-then-else had to be invented

#148
post #130
post #101

> That's just English, right? Except that it isn't. I can't use "else" as a conjunction in normal speech, only in computer programs. Sure you can! Shakespeare used 'else' in the same sense as 'otherwise': https://www.shakespeareswords.com/Public/GlossaryHeadword.as... "else used as a conjunction" https://wordtype.org/of/else "Or else!" was common speech before computers, and a common vague cartoon/cowboy/sign threat.

I am the author, and I mean that I can say "or else" in a normal sentence, but I cannot say "else" without an "or" in normal speech in my normal dialect.

Hmmm, thinking about my dialect of English (Lancastrian) I can certainly say else without an or and it doesn't sound unnatural to my ears. Something like "if you're hungry now then I can make you a sandwich, else we'll eat when we get to the pub" doesn't sound more awkward than using otherwise. I can't say whether that's just because the Lancastrian dialect preserves quite a few old fashioned usages that have fallen out of use in "standard" (i.e. southern posh) British English and American English, whether it's common usage in other dialects of British English, or if its just because I'm a programmer. Going to go ask some English teachers!

Re: If-then-else had to be invented

#149
post #147

Earlier quoted context omitted.

Maybe not in your dialect of English, but what about older dialects? "Pay for your beer. Else, leave this place at once!"

This is a usage that I have no memory of ever encountering in any context other than computer programming. It may be in some dialects, but not in ones I have come in conscious contact with.

Actually, no, you are right: I seem to have received one email message that begins a sentence with "else" in 1996 and another in 2003. So it is not unknown to me, but it is quite rare.

Re: If-then-else had to be invented

#150
post #118

The language REBOL used `either [] []` which I now miss regularly. It was great in that by default it pushed to me consider and deal with `else` in every case. There are allot of bugs left when stopping at 'if'.

A new REBOL like language is in the making:

https://www.red-lang.org/

Definitely worth a look.

Post reply on HN