lua-users home
lua-l archive

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




On 25/08/16 10:46 PM, Tim Hume wrote:


On Thu, 25 Aug 2016, Soni L. wrote:



On 25/08/16 10:37 PM, Tim Hume wrote:
 On Thu, 25 Aug 2016, Soni L. wrote:

> Heapsort assumes there is a length. Insertion sort is just bad, nowhere > near quicksort, and it also iterates, effectively calculating a length.

Maybe you can describe the problem you are trying to solve with a bit more
 context? That might make it easier to provide suggestions.

 Cheers,

 Tim.


I wanna sort a Lua table without a concept of length.

I guess the question is why do you want to sort the table without the concept of length? Is there some reason you don't know the length of the table?

Sorry if I don't quite understand. I'm not a computer scientist (I'm a meteorologist) - and am mostly self taught when it comes to programming ...

Cheers,

Tim.


Lua doesn't have a concept of length.

# is effectively undefined. __len is a thing. ipairs() stops on the first nil and respects __index. etc.

This is where not following a concept of length would shine. A lengthless sorting algorithm would be perfect for Lua.

--
Disclaimer: these emails may be made public at any given time, with or without reason. If you don't agree with this, DO NOT REPLY.