- Feature Articles
- CodeSOD
- Error'd
- Forums
-
Other Articles
- Random Article
- Other Series
- Alex's Soapbox
- Announcements
- Best of…
- Best of Email
- Best of the Sidebar
- Bring Your Own Code
- Coded Smorgasbord
- Mandatory Fun Day
- Off Topic
- Representative Line
- News Roundup
- Editor's Soapbox
- Software on the Rocks
- Souvenir Potpourri
- Sponsor Post
- Tales from the Interview
- The Daily WTF: Live
- Virtudyne
Admin
This was probably the developers frist programming project.
Admin
This was probably the developers frist programming project.
Addendum 2019-04-02 06:36: Damn those double posts
Admin
Meh. Seen worse.
Admin
At the very least, the dictionaries have been initialized. Imagine if they weren't!
Admin
Needs more
typedef
.Admin
No problem as long as the posts are not nested
Admin
5 hour crunch? This looks more like 48 hour sleep deprivation code, written without any plan or hope of success.
Please do not post the code that uses these data structures, some things are best not seen.
Admin
I thought it might look less bad with a shorter syntax like js :
var separatedFiles = { true : { true : {}, false : {} }, false : { true : {}, false : {} } };
… but you only see better how wrong it is.
Admin
Ugh, now I have code stench all over my pants leg. My wife is going to kill me when she sees this.
Admin
I don't see a problem with this. Any data structure can be emulated using a series of Dictionary<bool, string[]> if you nest them deep enough. Like, 150-200 levels or so should do the trick.
Admin
A dictionary with boolean keys should probably just be a pair (or tuple, or 2-element array, whatever is most convenient in the language).
Admin
That's a little like a certain axiomatic definition of the natural numbers, where, for example, 3 is written:
{{}, {{}}, {{{}, {{}}, {{}, {{}}, {{{}, {{}}}}
... unless I've miscounted my braces.
Admin
I think you miscounted. Per my understanding of https://en.wikipedia.org/wiki/Set-theoretic_definition_of_natural_numbers, 3 should be:
{{}, {{}}, {{}, {{}}}}
The number you wrote is close to 4, but has a few errant braces and should be:
{{}, {{}}, {{{}, {{}}, {{}, {{}}, {{{}, {{}}}}
... unless I've also miscounted my braces.
Admin
Yes, you miscounted.
Here's what you meant: 3 = {0,1,2} = {{},{{}},{{},{{}}}}
{\displaystyle 3={0,1,2}={\emptyset ,{\emptyset },{\emptyset ,{\emptyset }}}.}
https://en.wikipedia.org/wiki/Set-theoretic_definition_of_natural_numbers
Addendum 2019-04-02 12:51: stupid LaTeX got into my post ...
Admin
Funny thing, the true and false attributes referenced different file types. Three months after the project was submitted, the client started testing (and that's because this was !!URGENT!!) but had changed their process to only use one of the two file types.
So we really only use the true attribute, but no one actually has the balls to stick their hand in this hornet's nest and we just kept the original data structure, just neglecting the false part of the dictionary, which shall forever go unfilled.
Admin
Okay, this one actually made me say WTF aloud. I think this site may be getting better.
Admin
Indeed this was a try to use set theory for defining the fundamentals of mathematics:
In the beginning there is nothing. Let us create a set of nothing. Then we at least have something and let us put the symbol 1 to that. If we then define a new set with nothing and the set of something we can put the symbol 2 to that. And so on ...
And then came Russells Paradox.
Admin
You talk about Russell's Paradox like it's a bad thing.
All you do is implement the axiom of foundation (or something, my memory is patchy here) to disallow a set to contain itself (yes I know it's more complicated than that) and the job's done.
One of the main knock-on effects of defining an axiomatic framework for mathematics is that it enabled us to better understand exactly what we are allowed to do with sets. And once you've put your big-boy pants on and got over the intellectual stumbling-block that is Russell's Paradox, you can then go and bang your head against the grinning buddha that is the Axiom of Choice and its weaker descendants. Or you can explore non-standard set theory where you are allowed to relax the restriction imposed by the Axiom of Foundation, and thence use that model of set theory to investigate general digraphs.
Admin
Sorry, was not meant as a bad thing. It was just about a try to describe the fundamentals of mathematics and integers in the light of Set theory. The paradox Russel found out (and also Cantor) made a small change in definition on sets where an axiom was changed to not allow what lead to the paradox. or something like that. Its almost 40 years ago I did this ...
Admin
That's soooooooo weird... We had an offshore resource do something VERY similar for EXACTLY the same purpose. Of course, we replaced it w/ sensible classes and chucked his code...
Admin
This would be perfectly valid Python.
Admin
Whenever you see a bunch of brackets (ie "(/)", "{/}", "</>", etc.) at the start or end of a block, your first instict should be: "No wait, there's something wrong here". Only if you are certain there's no better way (ie "I might be able to rewrite this, but it would take about a week, and I don't have time to do this right now"), you should proceed. Nesting lists, or dictionaries, or anything, like in this example is a sure indicator that you are doing it wrong.
Admin
I suppose.it is a good thing that they didn't add a third file type instead then.