• (nodebb)

    This was probably the developers frist programming project.

  • (nodebb)

    This was probably the developers frist programming project.

    Addendum 2019-04-02 06:36: Damn those double posts

  • Little Bobby Tables (unregistered)

    Meh. Seen worse.

  • (nodebb)

    At the very least, the dictionaries have been initialized. Imagine if they weren't!

  • (nodebb)

    Needs more typedef.

  • King (unregistered) in reply to nerd4sale

    No problem as long as the posts are not nested

  • Tinkle (unregistered)

    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.

  • Java twist (unregistered)

    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.

  • Duston (unregistered)

    Ugh, now I have code stench all over my pants leg. My wife is going to kill me when she sees this.

  • Trust Me I'm Not a Robot (unregistered)

    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.

  • (nodebb)

    A dictionary with boolean keys should probably just be a pair (or tuple, or 2-element array, whatever is most convenient in the language).

  • Little Bobby Tables (unregistered) in reply to Java twist

    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.

  • Anonymous') OR 1=1; DROP TABLE wtf; -- (unregistered) in reply to Little Bobby Tables

    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.

  • Ross Presser (google) in reply to Little Bobby Tables

    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 ...

  • Karl (unregistered)

    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.

  • Djm (unregistered)

    Okay, this one actually made me say WTF aloud. I think this site may be getting better.

  • Hasseman (unregistered) in reply to Ross Presser

    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.

  • Little Bobby Tables (unregistered) in reply to Hasseman

    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.

  • Hasseman (unregistered) in reply to Little Bobby Tables

    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 ...

  • Barf4Eva (unregistered)

    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...

  • (nodebb)

    This would be perfectly valid Python.

  • 🤷 (unregistered)

    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.

  • Sam (unregistered) in reply to Karl

    I suppose.it is a good thing that they didn't add a third file type instead then.

Leave a comment on “An Objectionable Dictionary”

Log In or post as a guest

Replying to comment #:

« Return to Article