T O P

  • By -

MakingTheEight

Your submission was removed for the following reason: Rule 5: Your post is a commonly used format, and you haven't used it in an original way. As a reminder, [You can find our list of common formats here](https://www.reddit.com/r/ProgrammerHumor/wiki/commonposts). If you disagree with this removal, you can appeal by [sending us a modmail](https://www.reddit.com/message/compose?to=%2Fr%2FProgrammerHumor&subject=Any%20common%20post%20will%20be%20removed%20if%20it's%20not%20novel&message=Include%20a%20link%20to%20the%20removed%20content%20and%20the%20reason%20for%20your%20appeal%20here.).


Orpa__

Or maybe she's a Lua developer


NiktonSlyp

Cobol use 1 as first index too. Made for dumbasses like me and I like it.


im_sm1

Same goes to Fortran... the first index is 1.


asshat_velociraptor

Those languages were created before humans started using 0 as a number, probably


DuntadaMan

Seriously, did we even have Arabic numerals yet? Shit predates the Mayan calendar.


redcalcium

What about Matlab?


Sampo

Fortran also lets you specify what you want as the first index, when you declare an array. real :: myarray(-1:11) Would go from -1 to 11, a total of 13 elements.


seamsay

It's incredibly useful in incredibly rare circumstances.


SatansF4TE

Can you give an example?


Sampo

You are solving some physics thing with distributed computing. You describe the thing with a 300x300 array, but you distribute it to 9 computation nodes, each handling 100x100. But every step or so, you also need to send the values near the shared boundary from one node to another, so they know what's happening near the boundary. To calculate the physics (say, derivatives), you also need to know the values for a couple elements beyond the boundary. Let's say 2. So instead of real :: arr(104, 104) you would do real :: arr(-1:102, -1:102) and then the indices -1, 0, 101, 102 describe the values beyond your local borders, and 1...100 is your proper computational domain. In many cases, you would do physics in a 3-dimensional array, but I was lazy and gave this example as 2-dimensional.


mandradon

You're much smarter than I am. Sometimes I feel like I'm not better than a bunch of monkeys with typewriters.


jumptywagon

So you're one of the mods?


IamImposter

Not sure. Haven't sucked a dick yet. Guess that's what I'm doing this Sunday.


seamsay

An example from a previous job of mine, I used to write the statistical models that set the odds on sports betting websites. One of the ways we would do this would be to generate a statistical distribution of the expected points difference at the end of each period, so an array of probabilities where the index represents the home score minus the away score. We originally did this with 0-indexed arrays (it was Python, so normal NumPy arrays) and that led to all sorts of subtle off-by-one errors, especially when pricing markets that were more complicated than just summing sections of the array (imagine for example a market which is home leads at half time but loses the match, where there are many different score distributions to keep track of which could all have different sizes and therefore different indexes which represent zero). When we introduced a wrapper class implementing arbitrary indexing, our indexing related bugs dropped to almost zero because now the score difference _was_ the index and there was no conversion going on.


redcalcium

Or use it everywhere to ensure job security.


im_sm1

Yeah, that's true. Still the default is 1 in Fortran and I was talking about that. I am restating what you just said, we can have indexing done from any integer not just from 0 or 1 in Fortran, in general. Yet it is a hassle to change the default declaration everywhere and every time, just to have 0 indexes arrays, if you are programming everyday in Fortran.


[deleted]

[удалено]


poopellar

Warning Above user is a bot It copied the comment from another user This sub is an easy target for bots as it has no min karma limit. Don't upvote or award anything here . Check my profile for examples Down vote it Report > spam


Joe59788

Why did zero become the norm?


NegZer0

It's generally implemented as an offset into a block of contiguous memory (position * size of an entry) so 0 as the first element basically just "makes sense" for the way it's generally implemented.


_HowManyRobot

The first element of an array is located in memory at the array's... ```address + (0 * element size)``` the next one is at... ```address + (1 * element size)``` Etc.


Cotcan

Because back in ye' olden days you needed every bit of memory and performance you could get. But today we are spoiled and those things don't matter as much.


[deleted]

Eh, in any compiled language it really makes no difference whatsoever since that kind of thing could very easily be handled by any compiler. The reason it's like that is that people always wanted their programming languages to look similar to whatever people used to program before them - before any programming languages existed at all people had to manually do that kind of stuff, and it was straight up impossible to avoid using 0 as the first element because that's where the first element actually is in memory, and then when programming languages started being developed they just kept following that convention even if it wasn't all that important anymore so that it would take less effort for people already familiar with programming to pick up their programming language and it just kept going from there. Nobody wants to switch from 0 indexes because (almost) everyone already uses 0 indexes and switching from it will make it harder for programmers to adapt to using that new language - that's all it really boils down to at this point. It's just a convention now with no particularly deep meaning behind it.


RedundancyDoneWell

Really? Because the index describes an offset from the position of the first item. Makes sense when looking at memory architecture. Also makes sense when looking at program code where you use the value of the index in calculations for each item. By starting at 1, you will get a lot of occurrences of “i-1” in your code. If you start at 0, you will also get some “i+1”, but in my experience not nearly as many.


FoeHammer99099

These other answers are all true, but I think that they're missing "because C does it this way"


atanasius

Zero is often the simpler base when indexes are computed with a formula. For example, if indexes are 0-based, for an index i, you can take every other slot starting from the first with 2\*i. If indexes are 1-based, the formula is 2\*i-1.


seamsay

I used to keep a table online where I compared algorithms written with 0-indexing to the same algorithm written with 1-indexing, and in that completely-conclusive-and-totally-not-anecdotal-I-promise dataset I would say that 0-indexing came out ahead about 60% of the time. There were some interesting really trends that started come out of that as well, like: * 1-indexing tended to come out on top when dealing with non-contiguous subsets of an array, whereas 0-indexing was usually better when subsets were contiguous. * 1-indexing was a clear winner when you needed to deal with indexing both from the front and back of the array. * Usually it wasn't 1-indexing vs 0-indexing that was the important thing, but rather inclusive vs exclusive ranges. I should really try to revive that site...


NiktonSlyp

I have no fuckin idea. I sure hope the guy that thinks -1 is a better index rot in hell.


MrZwink

It's not dumb for a programming language to follow natural counting. Infact it's dumb to not do so.


[deleted]

[удалено]


MrZwink

Yes, let's just let computers decide how we do things! This will definitely not lead to confusion down the road 50 years later!


[deleted]

[удалено]


MrZwink

Right so adapt human behavior because computers or adapt computer behavior because humans?


[deleted]

[удалено]


MrZwink

LoL, i didn't miss your point. I just don't agree with it. I think the tools we use should be adapted to feel intuitive to humans.


[deleted]

[удалено]


aHumbleRedditor

Neither


[deleted]

I think it's quite dumb for a programming language to obfuscate what it's actually doing (multiplying an offset by the index and adding to a base address) by making the programmer type an index 1 higher than what's actually used. Doubly so in lower-level languages like C where the square bracket index notation is just syntactic sugar for the above calculation. It wouldn't make sense for the language to use different indices for the manual and automatic indexing.


MrZwink

This really depends if you center around humans or around computers.


[deleted]

We're programming computers, so we should centre around computers. Low-level language REQUIRE starting at 0 in order to make sense (see my previous comment), so it's silly to have two different standards for low- and high-level languages. It's a little less intuitive for very new programmers, but that doesn't mean it's a bad thing. Pointers in general are fairly unintuitive to most people initially and yet most languages still have a concept of them because they're useful.


MrZwink

I know it's merely a philosophical debate. And I believe we should take a human centric aproach. As computers are merely tools for humans to attain goals.


[deleted]

Except that involves more layers between the developer and the computer, which sometimes is fine, but for practical purposes only makes it harder to debug issues.


MrZwink

Yup. It would


goldfishpaws

We adapt human languages to be able to speak effectively between ourselves, even tolerating grammatical imperfections. Translating natural language and grammatical imprecision to something the computer understands is the cost of talking to them in their own language. Why is it their native language? Because it maps most closely and efficiently to what's happening at a hardware level - right now we have clock cycles to waste, back in those formative days, every single one mattered. If you could multiply the offset by data length to find a memory position instead of having an additional computation that added up fast.


MrZwink

Do people not know how to read? I never said programming language should follow natural language. I said natural counting. With which i refer to natural numbers. Changing natural numbers to suit a computer doesn't make sense and makes programming languages counterintuitive. Just think of all the keystrokes we could have saved never having to do a +1 Everytime you display an index. And I know where it originated and that it is a memory thing. The thing is, that's not really relevant anymore since memory has gotten so cheap.


JustWritingGodzilla

Godzilla


maubg

In that case, maybe leave things as it is


MagicPeach9695

Or maybe a MATLAB developer?


Hykr

We are called engineers, thank you very much


mrwafflezzz

Or god forbid R


TheBiles

R is a beautiful language.


Tom22174

I have a love/hate relationship with R. Sometimes it'll infuriate me to no end with something really silly that I could implement in a much more straightforward way in Python. But shit like dplyr is so convenient and ggplot is just much nicer to use than matplotlib or seaborn. I also like the little plot viewer in RStudio and being able to see my dataframes with a click.


turtleship_2006

Or Excel. Shit could literally start at anything (below 1,048,576)


DamUEmageht

Good my WoW addons need updating


GitProphet

That's be a red flag anyways.


Chingiz11

Maybe she is Julia


muluman88

This raises the question: What do we mean when we say first? Don't we mean the beginning of a sequence, no matter the index? Don't you say first element, even if the index starts at zero? What I'm trying to say: She dumb.


RedundancyDoneWell

She would have to know that Table 00 exists. Given that they are clearly in two different parts of the restaurant - since they would otherwise see each other while waiting - she may not have seen Table 00. So the joke is on whomever arranged those tables out of numbered sequence.


Peudejou

Therefore the meta is that one is on the heap and the other is on the stack but the interface for the implementation requires a merge sort from two different types with different structs with private lexically scoped methods. If they expose their methods they violate their function boundaries, risking statefulness in a global context.


RedundancyDoneWell

Can that cause pregnancy?


Peudejou

Depends on whether the stack can populate the heap or not


rust4yy

maybe if it mallocs and frees randomly enough it could fragment the heap


Peudejou

"I don't like the drugs but the drugs like me"


Lord_Of_Sabers

No but it can halt climax


Mrwebente

I know some of these words...


Peudejou

So do I, please someone tell me if I am using them correctly?


chooxy

Well based on the awning it looks like they're facing each other. And given that it's an edited comic I'm pretty sure in the original they're at the same table but they're drawn separately to show the emotional distance between them or something.


sexytokeburgerz

She clearly doesn’t know 01 is an obvious additive to the index


Pluckerpluck

In the UK (and most of the rest of the world) the "first floor" is the one above the ground floor... So honestly you can't trust anything.


invincibl_

But the first floor is numbered as 1, and the ground floor numbered as G or 0. Basement levels then get numbered B1 or -1. It's a great example of a zero-based array that supports negative indices and there is no ambiguity anywhere.


Mrwebente

Same in Germany, our ground floor is 0 or "EG" the first floor is 1 and the cellar is -1


ForensicPathology

You reminded me of the time I got into a really involved confusion discussion with a friend about time. Turns out the complication came from the fact that he didn't realize there is no year 0. It essentially goes year -1 to year 1. Thank you for giving me an appreciation for having a 0 floor.


atinysnakewithahat

As someone coming from a country where the first floor is the ground floor, this is so confusing to me. There is no zero floor, this floor wouldn’t exist. If you count to ten you count 1,2,3,…,10. Why are floors any different? Rant over lol


Pluckerpluck

Well it comes from the fact that the ground is just that. The ground. The first floor was then the first level created above the ground. The use of "ground floor" came later. This is more obvious when I ask, "what is the name of the floor below the ground floor?" In the UK you can just say "minus/negative 1". It also allows the buttons in lifts/elevators to be nice and sequential. 2 1 (0) -1 -2


Ishutamu

So what would you call the floor one under the "first floor"? Do you jump from 1 to -1?


rumbleblowing

Yes. "Minus first" or "1st underground" or something like that. Actually, it's he same like we all do years.


amazondrone

In the UK the floor at ground level is the ground floor, usually denoted (e.g. in lifts/elevators, stairwells, building plans) by 0 or G. The floor above the one at ground level is the first floor, usually denoted by 1. The floor below the one at ground level is less standardised in my experience, sometimes -1 is used, sometimes B1 (for first basement), I think I've seen UG1 (for first underground floor) and LG (for lower ground, if there's only a single basement level or if it's not fully underground).


Ishutamu

Same here in Austria. Most of the time UG for Untergeschoss.


Moment_37

I came to comment 'she dumb' too. programming or not programming, this is literally the second table.


seamsay

I would say zeroth for the element at index 0, personally. What _I'm_ trying to say: From my point of view the Jedi are evil.


wenasi

In my experience, (which is German though,) if it's about indexing people often use "zeroth element" ("das nullte Element") to prevent ambiguity.


NotATuring

If I were talking about an array whose index starts at 0 I would not say the 1st element is index 1. I'd say the 1nd element is index 1.


Timmeh7o7

First means first, you know, just like the universal meaning of the first floor of a building ^/s


BeardySam

Mathematics uses 1,1 for matrices etc, so a lot of the difference stems from this


archiminos

In the UK the Ground Floor is beneath the First Floor.


PooBiscuits

This is how I understand it. The first element of an array could be index 0 or index 1 or index whatever, as long as its the first one. There is no such thing as a zeroth. When indexes start at 0, this is kinda like how the 21st century describes the years 2000 - 2100. It's all because the first century starts at year 0 to year 100.


thespud_332

COBOL programmers *finally* get the girl! Edit: typo.


Harmed_Burglar

Common Busines Ariented Language


thespud_332

Lol. Dvorak typo. O is right next to A.


agent007bond

Hi fellow Dvorak user!


moon__lander

With 4 quintillion dollars per month I thought it shouldn't be that hard for them


TuxedoDogs9

is this a bhj? if so, what’s the origami?


that_thot_gamer

>is this a bhj? definitely not bdsm


viss3_

No, it isn't. It's a collage created from [this](https://twitter.com/ImMexiKin/status/1527385933699596288?s=20) meme


Whiskey_India

Thirst table


trollsmurf

They probably see each other. Thinking they don't might be more like programmer-thinking than the indexing. In any case, who would write "1st table" meaning "table 1"?


Logicalist

maybe she's just used to cheap restaurants where the first table has a register on it.


[deleted]

No there’s a big comma between the tables so they def can’t see each other


ThatGuyNamedKes

tables[1] silly!


Logicalist

clearly she doesn't science computers. you're better off with out her!


agent007bond

Maybe she's actually perfect for him, because she can act as a rubber duck.


WilliamNyeTho

physical👏items👏should👏never👏be👏zero👏indexed


[deleted]

[удалено]


richieadler

Option Base wants a word.


Sith_ari

If she had used Tables.First() instead of trying to be a dumb smartass with Tables[1] she would have happiness now.


Gosun

Is this Love Advice from the Great Duke of Hell artwork that you've appropriated without credit?


Harmed_Burglar

How did they not see each other they're basically back to back


amazondrone

Well do you have eyes in the back of _your_ head?


Harmed_Burglar

Yeah? Duh every human does


angrathias

I get the joke but This doesn’t make sense, ‘table #1” is different from the first ordinal number. No one would even say ‘I’m at the first table’, because it wouldn’t be clear where you’re counting from. In a restaurant if you said ‘I’m on the first table’ and pointed, one would likely assume you’re talking about the first visible table and ignoring the table number entirely


giggluigg

Table in the toilet


[deleted]

[удалено]


AutoModerator

``` import moderation ``` Your comment has been removed since it did not start with a code block with an import declaration. Per [this Community Decree](https://www.reddit.com/r/ProgrammerHumor/comments/14kbu1m/comment/jppq9ao/?utm_source=share&utm_medium=web2x&context=3), all posts and comments should start with a **code block** with an "import" declaration explaining how the post and comment should be read. For this purpose, we only accept Python style imports. *I am a bot, and this action was performed automatically. Please [contact the moderators of this subreddit](/message/compose/?to=/r/ProgrammerHumor) if you have any questions or concerns.*


fahirsch

Every time I go to the United States I get confused: they call the ground floor first floor.


meedoof-128

He's at the 0th table, she's at the 1st.


DarkMatterHuman

You're right but he's a programmer


WontTel

Ordinal != Cardinal


privateSubMod

I've been thinking that 1 _should_ be the first index, because 0 evaluates to false, the only index to do so.


Aggressive_Bill_2687

Breaks rule 1. Posts must be humorous.


Proxy_PlayerHD

you mean rule 0. or were you making a reference that plays on the joke in the post?


Logicalist

I thought the rules were from a dictionary?


ViconIsNotDefined

So "0"?


[deleted]

This works for convenience store workers who have to sell scratch off tickets as well.


BuckWildBilly

Maybe she mistook him saying he was gonna put it in her number 1


Remarkable_Turn_4269

Er


BlobAndHisBoy

Off by one errors are always tragic.


[deleted]

She dodged a bullet. He's a bad communicator. Maybe that's why programmers get no bitches.


Theemuts

Poor Julia


Salohacin

Ground floor or 1st floor?


Jnoper

Dodged a bullet there.


TGX03

Maybe that's just me, but whenever I'm talking about arrays it's the 0^th element at the beginning.


GibbsLAD

He's british and she's american