@mrtino Technically speaking, there are no arrays in C though... 🤔

Well, the language does implement arrays, but... its in fact a pointer to a memory address in the heap... In other words, arrays in C do not start at 0, but at their specific address... Same in C++ If I recall correctly...

So... while in other languages with protected types it might start at 0 or 1, in C/C++ they would trully start at 0x1fffecd or whatever.

You can still use indexes though... but these are just multipliers.

@mrtino Tu peux me dire comment tu fais un tableau en Perl qui commence pas par zéro ?

@mrtino Disons que je veux bien te croire, mais je ne vois pas comment on fait (et du coup j'ai de gros doutes ^^).

@mrtino Je crois que le Visual Basic permet de faire des tableaux qui ne commencent pas de zéro. Enfin, la doc dit que ça commence de zéro, mais il y a une fonction LBound [1] qui donne le premier index… ça serait bizarre de faire une fonction pour toujours renvoyer zéro.

[1] tutorialspoint.com/vbscript/vb

@thomas @mrtino
Je te confirme, en VB6/VBA, tu peux faire :
Dim Tableau(5)
Au quel cas, le tableau part de 0 ou 1 (voir Option Base) jusqu'à l'index 5
Sinon, tu peux faire :
Dim Tableau (-5 to 10)
Et là, à toi de t'amuser dans l'espace d'un entier 16 bits signé.

@thomas @mrtino
Cette permission n'est pas applicable à VB.NET qui lui fait systématiquement commencer les tableaux à 0.

Serious question 

Serious question 

Serious question 

Serious question 

Prelude> [4,6,1] ++ take 10 [3,7..]


@thfr @mrtino @AFresh1 hey, $[ has been discouraged since perl5 came out, became a noop in 5.16, and will become fatal in 5.30, the next release - metacpan.org/pod/distribution/$[

@mrtino actually in Star Wars 1, 2, and 3 are never found in arrays, it’s like they don’t even exist

@mrtino Arrays can start wherever?

That sounds like it would either be really useful, really frustrating, or both, based on my extremely limited knowledge of programming

@mrtino Haskell should have been in the "arrays can start wherever" group. Haskell array indexes don't even have to be numbers…

@mrtino For those times your arrays have a Holiday Special?

@mrtino @Sir_Boops not only Perl but also Pascal, for instance

it's pretty sad I know this

Sign in to participate in the conversation

Generalistic and moderated instance. All opinions are welcome, but hate speeches are prohibited. Users who don't respect rules will be silenced or suspended, depending on the violation severity.