Arc Forumnew | comments | leaders | submitlogin
5 points by sacado 6144 days ago | link | parent

A wiki would be nice too. And I don't find currying that useful.

As for arrays, what do you think of Lua's system for arrays ? In Lua, there is no explicit array (or lists), only hash tables. However, tables can be used efficiently as arrays : a table actually consists in two fields, one for numerical indices, the other one for "regular" keys.

As long as you use numerical keys, data is actually stored in an array, so there is no performance (or memory) penalty, and since this is only an implementation issue, there is no need to add explicitly vector manipulation functions. The bonus is that, if you use a very sparse array (e.g., only positions 1, 10 and 1000000, which would lead to 999997 unused positions), you get back to the hash system. It is a little slower than separating hashes / arrays, but it saves axioms.



3 points by tokipin 6144 days ago | link

i love Lua's tables. after using them, other languages feel abstruse in that department, with all these alternatives that are in my mind conceptually and functionally the same thing: (key,value) pairs

[edit]it should be noted that Lua is fast, like the fastest scripting language fast

-----

2 points by nex3 6144 days ago | link

I'm not much of a fan of Lua's array system... I'd rather give programmers explicit control of their data structures.

-----

4 points by mec 6144 days ago | link

For quick prototyping I can see how Lua's tables would be extremely useful. I've been trying to think of a way to combine lisp macros with Lua tables to see how that turns out.

-----