|
I know I may be alone on this but .. I just do not like Linq.
It biases for easy-to-write at the expense of easy-to-understand (to say nothing of perf implications of making non-inlineable callbacks for each item in the list).
Semantic details (like your example) matter, and I've spent way more hours debugging unexpected nuances like this, than I've saved by not writing a foreach loop in a little helper method.
|
|
|
|
|
ShawnVN wrote: I just do not like Linq.
Yep.
And even worse when it was forced down as a database layer. Now I have to do a database profile on every single usage just to make sure it actually does the expected SQL rather than deciding to do something non-sensical.
|
|
|
|
|
The All seems to work the same as any other language conjunctions. Search for "vacuous truth" to read about the underlying set theory origin of this definition in logic, which all (or at least all non-esoteric) programming languages define all. The same logic you can find at least in Python, JavaScript, C/C++, PHP, etc.
But on the other hand, if C# makes the method All does not return true without error on empty set, it will make C# special and unique language, so there might be benefits.
|
|
|
|
|
Have you ever heard of first-order logic - the logic which has been used formally for about 200 years (and informally much longer; on the order of 2000 years) for all sound reasoning in mathematics? Where it is obviously correct that "there is no x where P(x) is false" is equivalent with "for all x, P(x) holds" - because otherwise, that calculus would explode in your face ... Have you ever heard about vacuous truth?
If not, please take some time to learn about these things. That's neither a .Net nor a Microsoft thing - it's basic logic knowledge.
H.M.
|
|
|
|
|
One more for MS is right here (what??? how is that possible.)
Not really different from what others already wrote, but this is how I see it...
For me, Any(x) is the same as All(!x) so this must be true:
if list.Any(x) == false then list.All(!x) == true
which is true with the current implementation.
What you expect results in:
list.Any(x) == false and list.All(!x) == false.
... it's correct under your assumption, but to me it's illogic logic .
|
|
|
|
|
What was it like, being a WWII baby?
Freedom is the freedom to say that two plus two make four. If that is granted, all else follows.
-- 6079 Smith W.
|
|
|
|
|
The difficult we do right away...
...the impossible takes slightly longer.
|
|
|
|
|
The idea is that, being born on February 29th, you only have a birthday once every 4 years...and so you get older at a pace of 1/4th of everybody else.
Someone born on February 29th 1940 would only be "21" today...
Ok, I'm done mansplaining.
|
|
|
|
|
Thank you - I'd forgotten about the leap year "calculation"
|
|
|
|
|
OK Thanks for the explanation. Makes sense.
The difficult we do right away...
...the impossible takes slightly longer.
|
|
|
|
|
Actually you get older at the same rate as anyone else, but you only get 1/4 of the parties.
Alternatively your lifespan is only a quarter of those born in a "normal" year and you can expect to be an ex-you before you reach 22.
Either way, it seems a bum deal to me.
|
|
|
|
|
Realistically it's more about bragging rights than anything else.
Now imagine twins being born on a February 29th.
|
|
|
|
|
Worst case: Twins born 29 Feb 23:45 and 01 Mar 00:15 (or 28 Feb 23:45 and 29 Feb 00:15)
You can get a similar effect when Daylight Saving Ends (or Starts - I am never sure which way they go). You could have the eldest one born at 01:45, then clocks go back and the younger one is born at 01:30 but both have the same birthday.
|
|
|
|
|
Long ago (i.e. pre-URL) I read a similar story about a married couple who celebrated his and her wedding day on two different dates. During WW2 they were engaged, but he was called for war service before they had had an opportunity to arrange a marriage. They both feared that he might be lost in a battle, and if that happened they would want to be married.
So they had a marriage over military radio: She went to the nearest military camp, with her priest, and called up the station where the groom was located, where he had an army priest available, and they gave their "I do!" over the radio.
The thing was, the groom was stationed in the Pacific, across the date line. So although they were married at the same GMT time, the date was different for the two. The story as I heard it didn't reveal whether their marriage certificate stated one, the other or both dates, only that the groom returned safely home, and every year thereafter they celebrated for two days, one day for her and one day for him.
Religious freedom is the freedom to say that two plus two make five.
|
|
|
|
|
Conventionally there would only be one wedding registered, hence one wedding certificate which would normally show the date where it was registered.
|
|
|
|
|
jsc42 wrote: You could have the eldest one born at 01:45, then clocks go back and the younger one is born at 01:30 but both have the same birthday.
...and the youngest can claim to be the oldest...?
|
|
|
|
|
I think there is a well known story like that in the Book of Books.
Religious freedom is the freedom to say that two plus two make five.
|
|
|
|
|
interesting thing, in my company (300+ employees), no one was born on february 29.
or (conspiracy) they just put either february 28 or march 1st on the public facing anniversary web page.
CI/CD = Continuous Impediment/Continuous Despair
|
|
|
|
|
Well, you have less than 0.25 odds.
"In testa che avete, Signor di Ceprano?"
-- Rigoletto
|
|
|
|
|
Maximilien wrote: (300+ employees),
Even assuming perfectly even distribution, "300+" employees is just too small a sample to get someone born on February 29th.
I'm thinking (again, assuming even distribution, which is not realistic), you'd need a group of at least 365*4(+1?) people to be guaranteed to find one born on that day (maybe? stats have really never been my thing)...
|
|
|
|
|
Birthdays are counter intuitive: the odds of two people in a group of 23 sharing the same birthday are better than 50-50 ... Birthday paradox[^]
I've forgotten most the the statistics I used to know, but I'd say a very similar method would apply to leap kids.
And birthdays aren't evenly distributed (although the distribution does vary depending on culture: Western "likely to conceive" days are different from Chinese ones). In the northern hemisphere for example, you get more children conceived between October and January (as it's cold and wet outside ...) to give more birthdays between July and October.
"I have no idea what I did, but I'm taking full credit for it." - ThisOldTony
"Common sense is so rare these days, it should be classified as a super power" - Random T-shirt
AntiTwitter: @DalekDave is now a follower!
|
|
|
|
|
Quote: I was born on the 2nd of August, exactly 33 years before my father was born. The first sentence of that link reads oddly to say the least.
"the debugger doesn't tell me anything because this code compiles just fine" - random QA comment
"Facebook is where you tell lies to your friends. Twitter is where you tell the truth to strangers." - chriselst
"I don't drink any more... then again, I don't drink any less." - Mike Mullikins uncle
|
|
|
|
|
I thought all bloggers were given a time machine? Did you not submit a Form 125/AC/TM/776(a) to the Mekon?
"I have no idea what I did, but I'm taking full credit for it." - ThisOldTony
"Common sense is so rare these days, it should be classified as a super power" - Random T-shirt
AntiTwitter: @DalekDave is now a follower!
|
|
|
|
|
What!? I'm always the last to know!
"the debugger doesn't tell me anything because this code compiles just fine" - random QA comment
"Facebook is where you tell lies to your friends. Twitter is where you tell the truth to strangers." - chriselst
"I don't drink any more... then again, I don't drink any less." - Mike Mullikins uncle
|
|
|
|
|
It's my daughters birthday today, I'm contemplating to get her a baby chair at the restaurant tonight.
|
|
|
|