this post was submitted on 09 Jul 2023
614 points (93.9% liked)

Programmer Humor

31812 readers
545 users here now

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

Rules:

founded 5 years ago
MODERATORS
 
you are viewing a single comment's thread
view the rest of the comments
[–] [email protected] 31 points 1 year ago* (last edited 1 year ago) (1 children)

It depends. x and y are either elements or coordinates, a and b usually elements though in e.g. Haskell reserved (by convention) for type variables.

The i j k l series is reserved for indices. n m etc. are the counts of something, as such you'll see i counting up to n. Both are due to mathematical sum notation and general mathematical convention. Random google result:

Let x~1~, x~2~, x~3~, …x~n~ denote a set of n numbers. x~1~ is the first number in the set. x~i~ represents the ith number in the set.

...if you're using a language in which you use i often chances are you should stop coding in C and get yourself a language with iterators. Manual loops are a bug magnet.

[–] [email protected] 5 points 1 year ago (1 children)

It's a shame iterators in JS are trash for memory if you have a giant array

[–] [email protected] 6 points 1 year ago

Iterators in rust are awesome I really hope we will see zero cost abstractions like this more in other languages