• NateNate60@lemmy.world
    link
    fedilink
    arrow-up
    3
    ·
    edit-2
    55 minutes ago

    Bullshit.

    Every programmer knows that 'A' in ['A', 'B', 'C', 'D'] would be the 0th item; the first item is 'B'

    • spikespaz@programming.dev
      link
      fedilink
      arrow-up
      7
      ·
      36 minutes ago

      That would be wrong in every technical sense. You’re saying that .first() would skip the 0th item.

      First = leftmost.

      • NateNate60@lemmy.world
        link
        fedilink
        arrow-up
        3
        ·
        edit-2
        31 minutes ago

        That’s because the word “first” in first() uses one-based indexing. In true programmer fashion it would have been called zeroth() but that is wholly unintuitive to most humans.

        I maintain that the element with the lowest index is called the “zeroth” element in zero-based indexing and “first” in one-based indexing. The element with index N is the Nth element.

        • dave@feddit.uk
          link
          fedilink
          English
          arrow-up
          2
          ·
          28 minutes ago

          Most humans wouldd never write the word first followed by (). It absolutely should have been zeroth(), and would not cause any confusion amongst anyone who needed to write it.

          • JustAnotherRando@lemmy.world
            link
            fedilink
            arrow-up
            1
            ·
            10 minutes ago

            It absolutely should not have been named zeroth() because the reasoning for that is purely pedantic and ignores WHY arrays are 0 indexed. It’s not like the people in the early days of writing programming languages were saying “the zeroth item in the array” - they would refer to it using human language because they are humans, not machines. Arrays are 0 indexed because it’s more efficient for address location. To get the location in memory of an array item, it’s startingAddress + (objectSize * index). If they were 1 indexed, the machine would have to reverse the offset.
            Function/Method names, on the other hand, should be written so as to make the most sense to the humans reading and writing the code, because the humans are the only ones that care what the name is. When you have an array or list, it’s intuitive to think “I want the first thing in the array” or “I want the last thing in the array),” so it makes sense to use first and last. That also makes them intuitive counterparts (what would be the intuitive counterpart to “zeroth”?).

  • drunkpostdisaster@lemmy.world
    link
    fedilink
    arrow-up
    21
    arrow-down
    1
    ·
    3 hours ago

    And then he texts back ‘where are you?’ And then she texts back ‘the first table’ and he replies ‘umm I’m here too. But I don’t see you’ confused she asks him ’ table 0p?’ And then ‘01*?’ He says ‘no, 00.’ Releaved she says ‘lol I am at table 01’ he chuckles ‘I am at 00, I’ll go find you’

    Later they get married and have kids. But relationship collapses and it ruins both of them and they cannot find the heart to love anyone again. Their children grow up broken and struggle through life. Some get arrested end up in prison, all of them repeatedly fall into a series of toxic relationships for the rest of their lives.

  • Anna@lemmy.ml
    link
    fedilink
    arrow-up
    20
    ·
    4 hours ago

    Hey, if she thinks 1 is 1st index then you dogged a bullet and deserve better.

  • yesman@lemmy.world
    link
    fedilink
    arrow-up
    19
    ·
    5 hours ago

    The real punch line is that in a cafe run by programmers, esoteric rules are in full force, but tables 0 and 1 are no where near each other.

      • gallopingsnail@lemmy.sdf.org
        link
        fedilink
        arrow-up
        1
        ·
        edit-2
        56 minutes ago

        Your job is to move apples from one bin to another. You pick up the first one and set it in the other bin, and say “zero.”?

        • spikespaz@programming.dev
          link
          fedilink
          arrow-up
          1
          ·
          34 minutes ago

          There’s another way to think about it which I actually use. Look in the empty bin and say “zero”, then move an apple and say “one”.

      • NateNate60@lemmy.world
        link
        fedilink
        arrow-up
        1
        ·
        57 minutes ago

        Rulers measure cardinal quantities and not ordinal ones. There is no cardinal numbering scheme that starts at 1, all of them “start” at 0. For ordinal numbering schemes, the symbols are arbitrary anyway and you can start with whatever you want. It’s equally valid to start with 1, 0, -1, A, or “aardvark”. The only benefit to picking 1 as the start is to make it easier to count with your fingers while picking 0 lets you easily convert an ordinal quantity to a cardinal one.

      • Godnroc@lemmy.world
        link
        fedilink
        English
        arrow-up
        8
        ·
        4 hours ago

        I’ve seen a lot of rulers that actually don’t have a mark at 0 and instead go right to the edge as 0. Typically they are worn down, being made of wood, so the accuracy of the first inch is dubious. To ensure the distance is correct, sliding the ruler down one unit is a good idea. So, my ruler starts at 0 but my measurements start at 1.

          • xthexder@l.sw0.com
            link
            fedilink
            arrow-up
            8
            ·
            3 hours ago

            It really depends on what you’re measuring. Good luck measuring the distance from a corner if you can’t get 0 to touch the end.

            Tape measures are almost always designed with this in mind, so you can hook the end over an edge, or butt it up against something and the measurement will be accurate both ways, since the metal end can slide in or out by just the right amount.

      • affiliate@lemmy.world
        link
        fedilink
        arrow-up
        7
        ·
        5 hours ago

        i wish the people making buildings around here knew that. some start at floor 3, others at 5. some start at 0. others at 2. every building has its own story. you need to understand the building before you can understand your position in it.

    • CanadaPlus@lemmy.sdf.org
      link
      fedilink
      arrow-up
      8
      arrow-down
      1
      ·
      6 hours ago

      Why? It seems exactly as valid to me, and more valid if you like positional numberings of your physical stuff.

      You just count the number of times you departed from an item in order, rather than the times you arrived.

  • netvor@lemmy.world
    link
    fedilink
    arrow-up
    39
    ·
    8 hours ago

    Don’t wanna state the obvious, but it looks like they still ended up staring at each other for the rest of the evening.

    They have shown that they still love each other, so hope they can work with their one irreconcilable difference.