Kancane
IT with gentleness
  • About
  • Contact
marbles
2016-07-29

Empty sets are amazing!

I was triggered by a C# puzzle on twitter by Bill Wagner.
I’ll repeat the puzzle here:

Create a sequence where Any() returns false, and All() returns true.

That got me pauzed for a while. Then it occurred to me it could only be true for an empty set, but I was not sure …
I had to check it with some code. Code speaks the truth, doesn’t it? 😉

It feels so counter intuitive, but we can say anything about all elements in an empty set! Wow, mind blowing!

I was trying to explain it to my daughter (16) but I could not find any convincing example that could explain it properly.
Suddenly I had a brilliant ideaâ„¢: Take the function

f(x) => 1 / x.

X’s close to zero will give values of near infinity (or at least very large numbers). Thus an empty set can be really anything!
But she debunked it by saying I had not proved any reason why I chose f(x) => 1 / x as my basis!

Uhmm, well … thanks for the brilliant ideaâ„¢ so far …

In the end we could agree that a bag with zero blue marbles is equal to a bag with zero red marbles. Or a bag with zero euros (or dollars if you prefer). Or a bag with zero of anything!

Happy coding!

// Ryan

A new beginning How to enable encoding code page 1252 in dotnet core

Related Posts

code page 1252

Uncategorised

How to enable encoding code page 1252 in dotnet core

Recent Posts

  • Git in a nutshell
  • How to enable encoding code page 1252 in dotnet core
  • Empty sets are amazing!
  • A new beginning
Kancane
Kancane © 2016-2019