Skip to content

[feature] list.sort() #29

@RiedleroD

Description

@RiedleroD

sorting arrays is one of those things that seems trivial, but if you don't have a builtin way to do it, it's absolute ass. nobody wants to implement a sorting algorithm from scratch, especially not in a relatively minimal, purely interpreted scripting language.

I'd say:

  • numbers are obvious
  • strings get sorted by character value (e.g. ["-", "5head", "Aardvark", "Axe", "age", "apple"])
    if equal up until one of two strings ends, the shorter one gets sorted first (e.g. ["", "lig", "ligma", "ligma balls"])
    hit me up if you need help implementing an algorithm for this. a simple dual-pass std::sort should work. I'd have to look at what options the dart stdlib gives us.
  • lists are handled like strings, except instead of "character value", items get compared to each other.
  • maps aren't sorted and thus can't be analyzed the same way. maybe just length? or maybe we just don't let the user sort a list of dictionaries. It doesn't really make sense to do that.

Metadata

Metadata

Assignees

Labels

enhancementNew feature or requeststdlibThis issue is about the standard library

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions