this post was submitted on 19 Sep 2024
830 points (98.4% liked)

Programmer Humor

32051 readers
1885 users here now

Post funny things about programming here! (Or just rant about your favourite programming language.)

Rules:

founded 5 years ago
MODERATORS
 
top 50 comments
sorted by: hot top controversial new old
[–] aluminium@lemmy.world 4 points 31 minutes ago

She was a lua girl, he was every other programming language guy. It was not ment to happen.

[–] ikidd@lemmy.world 1 points 37 minutes ago
[–] lustyargonian@lemm.ee 10 points 2 hours ago

If you love me meet me at first floor

Americans 😢 British 🤷‍♂️

[–] Philo_and_sophy@lemmygrad.ml 1 points 59 minutes ago

Also the plot of Before Sunset 🏆

[–] drunkpostdisaster@lemmy.world 23 points 4 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.

[–] PeriodicallyPedantic@lemmy.ca 18 points 4 hours ago

🙅 zeroth, first, second, third
👉 Zerost, onest, twost, threest

[–] NateNate60@lemmy.world 1 points 1 hour ago* (last edited 1 hour ago) (2 children)

Bullshit.

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

[–] spikespaz@programming.dev 14 points 1 hour ago (1 children)

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

First = leftmost.

[–] NateNate60@lemmy.world 3 points 1 hour ago* (last edited 1 hour ago) (3 children)

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.

[–] communism@lemmy.ml 4 points 37 minutes ago

No, there is simply no such thing as "zeroth", that's not how ordinal numbers work. If I have the following numbered list:

  1. Foo

  2. Bar

  3. Baz

The first item is "Foo" which is indexed 5. It is not the fifth item, because the item indexed 5 comes first in the list, so the item indexed 5 is the first item. Ordinal numbers don't refer to index, they refer to order.

[–] melmi@lemmy.blahaj.zone 1 points 25 minutes ago

Indexes start from zero because they're memory offsets, but array[0] is still the first element because it's an ordinal number, not an offset. It's literally counting each element of the array. It lines up with the cardinality—you wouldn't say ['A', 'B', 'C'] has two elements, despite array[2] being the last element.

[–] dave 2 points 1 hour ago (1 children)

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 4 points 1 hour ago (1 children)

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"?).

[–] dave 1 points 33 minutes ago

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

Of course—that’s why we have such classics as stristr(), strpbrk(), and stripos(). Pretty obvious what the differences are there.

But to your point, the ‘intuitive’ counterpart to ‘zeroth’ is the item with index zero. What we have is a mishmash of accurate and colloquial terms for the same thing.

[–] rain_worl@lemmy.world 1 points 30 minutes ago

1st would be 'B', first is 'A'

This would work better as Nth floor of a building

[–] AnnaFrankfurter@lemmy.ml 21 points 5 hours ago (1 children)

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

[–] MadBob@feddit.nl 21 points 4 hours ago

you dogged a bullet

😳

[–] yesman@lemmy.world 21 points 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.

[–] pelya@lemmy.world 36 points 6 hours ago (4 children)

In the UK it's called a ground table.

[–] undergroundoverground@lemmy.world 1 points 42 minutes ago

When you get off an airplane, do you say

"Its great to be back on solid first floor of the earth."

?

[–] AngryCommieKender@lemmy.world 14 points 6 hours ago (1 children)

So it was a spelling mistake? They're actually The Knights of The Ground Table!

load more comments (1 replies)
load more comments (1 replies)
[–] LillyPip@lemmy.ca 11 points 5 hours ago (1 children)
[–] lefixxx@lemmy.world 63 points 7 hours ago (3 children)

She is right, using 0 index for physical stuff is stupid.

[–] jmcs@discuss.tchncs.de 14 points 5 hours ago (3 children)

Your rulers start at 1? That sounds annoying.

[–] gallopingsnail@lemmy.sdf.org 1 points 1 hour ago* (last edited 1 hour ago) (1 children)

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 3 points 1 hour 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 1 points 1 hour 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 9 points 4 hours ago (1 children)

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.

[–] jmcs@discuss.tchncs.de 6 points 4 hours ago (1 children)

That's why decent rulers have a 0 and a margin:

plastic ruler starting at 0 cm

[–] xthexder@l.sw0.com 10 points 4 hours ago (2 children)

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.

[–] june@lemmy.dbzer0.com 1 points 1 hour ago

since the metal end can slide in or out by just the right amount.

OMG! I genuinely thought all the tape measures I have handled were a little broken.

[–] kurwa@lemmy.world 2 points 4 hours ago

Just shave down the rulers margin!

[–] Barbarian@sh.itjust.works 16 points 6 hours ago (2 children)
[–] AngryCommieKender@lemmy.world 13 points 6 hours ago

Not on this side of the pond. We typically don't have a ground floor, that's just the first floor.

[–] affiliate@lemmy.world 7 points 5 hours ago (1 children)

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.

[–] HeyThisIsntTheYMCA@lemmy.world 6 points 2 hours ago (2 children)

if a building is built into a hillside in the uk and has exits on floors 2 and 5, which would be the ground floor?

[–] june@lemmy.dbzer0.com 1 points 1 hour ago

My intuition would be floor 2, as it is the lowest floor to the ground that isn't underground

[–] affiliate@lemmy.world 2 points 2 hours ago

it’s floor 5 from monday to wednesday, and floor 2 from thursday to sunday

[–] CanadaPlus@lemmy.sdf.org 7 points 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.

[–] yonder@sh.itjust.works 27 points 7 hours ago

That is why my restaurant will number tables by UUID.

[–] sasquash@sopuli.xyz 24 points 7 hours ago

maybe she's a lua developer

[–] No_Money_Just_Change@feddit.org 3 points 4 hours ago

Plot twist, neither cared about the table number

One went to the first table produced, the other to the first table placed

[–] netvor@lemmy.world 39 points 9 hours ago (2 children)

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.

load more comments (2 replies)
load more comments
view more: next ›