lua-users home
lua-l archive

[Date Prev][Date Next][Thread Prev][Thread Next] [Date Index] [Thread Index]



On 19-Aug-04, at 7:00 PM, Mark Hamburg wrote:

Is it correct to summarize functional tuples as being essentially equivalent to immutable, pure arrays -- i.e., tables that can't be changed and that
only have entries from 1 to n for some value of n?

Presumably, one could actually even have mutable tuples. You just can't
change the number of values in the tuple.

Yes, that would be the proposal.

As I mentioned at the end of the probably-too-long message from earlier today, there are some potential optimisations which work better if the tuple is immutable. On the other hand, there are probably some applications (vector arithmetic springs to mind) which might like to be able to update in place. I personally prefer the immutable flavour; but it is certainly trivial to implement mutable tuples using the same basic architecture, because iirc
lua_replace() works on pseudo-indices.