- D1 Meta Docs - Denizen Script -
Home Page / Pi to one million places / Contact mcmonkey / Donate / Paste Scripts / Denizen Help /
You are browsing as a guest.
Login | Register




Search:

Listing Tags...

 View All

Found 1 match.
MatchListTag.sort[<procedure>]
Name<ListTag.sort[<procedure>]>
ReturnsListTag
Descriptionreturns a list sorted according to the return values of a procedure.
The <procedure> should link a procedure script that takes two definitions each of which will be an item
in the list, and returns -1, 0, or 1 based on whether the second item should be added. EG, if a procedure
with definitions "one" and "two" returned -1, it would place "two" after "one". Note that this
uses some complex internal sorting code that could potentially throw errors if the procedure does not return
consistently - EG, if "one" and "two" returned 1, but "two" and "one" returned 1 as well - obviously,
"two" can not be both before AND after "one"!
Note that the script should ALWAYS return -1, 0, or 1, or glitches could happen!
Note that if two inputs are exactly equal, the procedure should always return 0.