[Date Prev][Date Next][Thread Prev][Thread Next]
- Subject: Re: When is multiple assignment good style?
- From: Francisco Olarte <folarte@...>
- Date: Thu, 16 Mar 2017 11:03:07 +0100
On Thu, Mar 16, 2017 at 3:31 AM, Nagaev Boris <firstname.lastname@example.org> wrote:
> On Thu, Mar 16, 2017 at 2:09 AM, Hisham <email@example.com> wrote:
>> (I've even seen `local append = table.insert` in the wild!).
> It is not very surprising, because Go, Swift and Python call this
> thing "append"
I'm not familiar with go or swift, but I'd like to point Pyhton calls
it INSERT. The difference is the index is not optional and it has
another function called append which does insert-at-end ( to be
expected in a system where you have lists with a defined length
separated from mappings ).
> we already have push_back (C++),
C++ has, i.e. in vector, INSERT ( and push_back too )
> array_push (PHP).
This are ( more or less ) variations of Python's append. The thing is
lua does NOT have append(at end, and generally amortized constant time
in many languages), you have to do it using generic insert(at any
position, including end, amortized constant time in many of those
languages but, IIRC, not in lua ( unless you are caching the length,
which I'll consider cheating ))