4 ms·
> Lists are accessed only via .at() If clarity is the goal, then data structures that support access by index should be called `arrays` or `vectors`
by sesm 8mo ago
> Lists are accessed only via .at()
If clarity is the goal, then data structures that support access by index should be called `arrays` or `vectors`
- rkeene2 8mo agoAlso why num/num32 for Integer types, and no floating point type
- hedayet 8mo ago[author here] Very good questions; I definitely would like to revisit num32 very shortly. I'd say the initial rational of having num32 is not coherent right now, but I'll have to verify removing the support. we have floating point type(It was missing from the type list in readme. I have just updated that seeing this comment. thank you!)
- teiferer 8mo agoWell, clarity would be achieved with a name like u64. Is num signed? What's the range? Is it integers or floating point? All these things are hidden. With u64 there would be no questions open. (Well a few maybe, like overflow behavior, but can't have it all..)
- rurban 8mo agoThere cannot be any num32. num is a number, which can be fixed size integers, floating point numbers (of fixed size or not) or bigints. Some also add decimals num32 being i32 or f32 makes no sense
- hedayet 8mo agonow we have only int64 for integer types and float64 for floating point types. Thanks everyone for your thoughtful feedback!
- rkeene2 8mo agoNeat !
- joshuamorton 8mo agoThis is very language dependent. People coming from python or Java would call them lists. Vectors are a mathematical concept unless you use c++.
- vlovich123 8mo agoIn Java it’s called Vector / list refers to linked list. Python doesn’t have a linked list type so it’s kinda irrelevant. But also not every language has to be Algol centric even though Algol has largely dominated the design space of popular languages due to familiarity.
- brabel 8mo ago> In Java it’s called Vector / list refers to linked list What?!! No! Vector is almost never used in Java code. When you need index-based access, ArrayList is the much more common one, and it does implement List. So I would agree with parent commenter that List is the equivalent in Java. A List in Java is a container that allows iterating over items efficiently, but does not necessarily provide efficient random access: https://docs.oracle.com/javase/8/docs/api/java/util/List.html https://docs.oracle.com/javase/8/docs/api/java/util/List.htm... If you care about why Vector is nearly never used: it is synchronized by default, making it slower and more complex than ArrayList. Most Java programmers would prefer to implement synchronization themselves in case multi-threading is required since it nearly always involves having to synchronize multiple list operations at the same time, which cannot be done with Vector. It's the same reason no one uses StringBuffer, but StringBuilder.
- vlovich123 8mo agoI’m aware. The preferred name is clearly Vector and ArrayList is the wordy alternative they had to use to not break back compat. List is the name to the interface which encompasses a lot of different data types. But ask a Java programmer of they prefer to use arrays or lists and I suspect they won’t even think twice about understand that the list you’re referring to is a linked list rather than asking what you mean because arraylist implements list. A fun Java weirdness is that of course arrays themselves do not implement list
- hedayet 8mo ago[author here] What @joshuamorton said + my rationale was - for natural language users too, a "list" should be more intuitive than `array` or `vector` I'm more than happy to be corrected though.
- anon291 8mo agoThe idea of being inspired by natural language is completely at odds with also desiring clarity first