From: Johann H. <jhi...@ya...> - 2004-02-08 23:48:14
|
On Feb 7, 2004, at 6:15 PM, Jamie Webb wrote: > On Friday 06 February 2004 03:42, Johann Hibschman wrote: >> Well, "list" is a natural language word, so it's broad and doesn't >> promise much. A "vector" is a rather specialized technical word, more >> specialized than even "array", so it promises a lot. > > That's just it though: all three are rather specialised technical > words. The > exact way in which they are specialised depends on the field you work > in. Well, there is still a difference. "list" is common language, that's been co-opted by many programming languages to mean linked lists, but it's certainly not omni-present. For example, I do a lot of Python, and Python lists are vector-like lists, not linked lists. However, it's certainly true that the list/vector difference is maintained in Scheme, Common Lisp, Java, OCaml, and probably many other languages. It doesn't really matter that much. I can always rename any "vector" module to "list" and be done. I'm just lazy, find it easier to type "list", and think its natural-language overtones mesh better with the word "table". > Since Lua is a mixed imperative/functional language, we should take > our > definitions from those worlds: Arrays are fixed-size, n-dimensional > mutable > structures with O(1) random access, O(n) inserts, etc., Vectors are > single-dimensional, mutable and resizable in imperative languages, > with O(1) > random access, O(n) inserts, etc. Lists are mutable and resizable in > imperative languages, and have O(n) random access and O(1) inserts. > Data > Structures books may qualify such lists as linked lists, but > programming > languages such as C++, ML, and LISP don't. Actually, this reminds me. What are the times on Lua tables? I know that integer indices are special, but do they get true O(1) access? Presumably, other keys are O(log n), as usual. > Also, the implications of a misunderstanding differ: If a user were to > assume > he was dealing with a mathematical vector when in fact he wasn't, that > could > only be as a consequence of a more direct misunderstanding of the > operations > he is performing, and the interpreter is likely to complain very > quickly. > OTOH, if a programmer were to assume he was dealing with a linked > list, he > could quite happily produce a working program, only to discover once > he tries > it on production-scale data that it runs N times slower than expected. That's certainly true, but I think it's very unlikely. >> At work, I'm converting over some old APL programs, so I'll probably >> have some extremely screwy ideas in a few weeks, if I can ever get the >> blasted font to work. Now _there_'s a concise language. > > Mmm... I thought those people who still dealt with APL tended to use > ASCII > representations these days? Nah, ASCII representations are for the weak. You need the funny arrows and things. :-) In any case, I don't see much of a point in continuing to discuss this, since I can always rename packages to whatever I prefer. If you would really rather call it a vector package, we can just go with that. Cheers, Johann |