# PureBasic Forum

 It is currently Sat Jan 23, 2021 12:17 pm

 All times are UTC + 1 hour

 Page 1 of 1 [ 5 posts ]
 Print view Previous topic | Next topic
Author Message
 Post subject: [Done]SortList(), SortStructuredList()Posted: Mon Dec 02, 2019 10:25 pm

Joined: Thu Jun 07, 2007 3:25 pm
Posts: 3967
Location: Berlin, Germany
Documentation of both SortList() and SortStructuredList() wrote:
Start, End (optional) : The index of the first and last element in the list that should be sorted.

When working with indices, the question is always whether the first index is 0 or 1. This question should be answered in the documentation of SortList() and SortStructuredList().
Even more comprehensive information will be given by linking the word "index" in the sentence above to the help page of ListIndex() (as it was done in the documentation of RandomizeList()).

_________________
Please excuse my flawed English. My native language is PureBasic.
Search
RSBasic's backups

Top

 Post subject: Re: SortList(), SortStructuredList()Posted: Wed Dec 04, 2019 10:28 am
 Enthusiast

Joined: Sat Oct 06, 2007 11:20 pm
Posts: 297
Location: France
Hi.
Sortlist is using list(). The first element of a list always start at 0. So, it's the same thing when you're using sortlist etc..
it could be written in each order concerning the lists but it is already indicated in the documentation of the main order "list".

Code:
NewList test()

For i = 1 To 10
test()=i
Next

RandomizeList (test(),0,9)

ForEach test()
Debug Str(test()) + " : num " + Str( ListIndex(test() ))  + " from the list"
Next

Debug ""
Debug "Sort_ascending"
Debug ""

SortList(test(), #PB_Sort_Ascending,0,3) ; first element is in position 0 and 4rth element position is 3

ForEach test()
num.s = Str( ListIndex(test() ))

Debug Str( test() ) + " : num " + num  + " from the list"
c+1
If C = 4 : Debug "-----" : EndIf

Next

_________________
~Ar-S~

My webSite (french) with PB apps : LDVMULTIMEDIA
PB - 5.4x LTS / 5.7x - W10 x64 - Ryzen 7 3700x
Repeat : try : until done = 1

Top

 Post subject: Re: SortList(), SortStructuredList()Posted: Wed Dec 04, 2019 10:50 am

Joined: Thu Jun 07, 2007 3:25 pm
Posts: 3967
Location: Berlin, Germany
ar-s wrote:
The first element of a list always start at 0.

Yes, I know.
The problem is, that this fact is not mentioned in the documentation of SortList() and SortStructuredList().

Mentioning it anywhere in the "List" chapter of the documentation is not sufficient. When the user wants to learn how to use SortList() or SortStructuredList() properly, s/he should find all required information in the help topic for SortList() or SortStructuredList(), without the need to search elsewhere in the help. The best solution will be to set a link to the help page of ListIndex(), as I wrote above. Exactly this is already done in the documentation of RandomizeList(), so there should be no problem with doing the same in the documentation of SortList() and SortStructuredList().

_________________
Please excuse my flawed English. My native language is PureBasic.
Search
RSBasic's backups

Top

 Post subject: Re: [Done]SortList(), SortStructuredList()Posted: Wed Apr 01, 2020 2:34 pm

Joined: Thu Jun 07, 2007 3:25 pm
Posts: 3967
Location: Berlin, Germany
Documentation Editors wrote:
[Done]

I see the additional notes regarding this issue in the help that ships with PB 5.72 LTS. Thank you!
However, the online help for SortList() and SortStructuredList() is not yet updated accordingly.

_________________
Please excuse my flawed English. My native language is PureBasic.
Search
RSBasic's backups

Top

 Post subject: Re: [Done]SortList(), SortStructuredList()Posted: Wed Apr 01, 2020 3:03 pm
 Enthusiast

Joined: Fri Feb 24, 2012 10:19 am
Posts: 205
Yes, i know, but only Fred can do that.
Sorry.

M.

Top

 Display posts from previous: All posts1 day7 days2 weeks1 month3 months6 months1 year Sort by AuthorPost timeSubject AscendingDescending
 Page 1 of 1 [ 5 posts ]

 All times are UTC + 1 hour

#### Who is online

Users browsing this forum: No registered users and 1 guest

 You cannot post new topics in this forumYou cannot reply to topics in this forumYou cannot edit your posts in this forumYou cannot delete your posts in this forum

Search for:
 Jump to:  Select a forum ------------------ PureBasic    Coding Questions    Game Programming    3D Programming    Assembly Programming    The PureBasic Editor    The PureBasic Form Designer    General Discussion    Feature Requests and Wishlists    Tricks 'n' Tips Bug Reports    Bugs - Windows    Bugs - Linux    Bugs - Mac OSX    Bugs - IDE    Bugs - Documentation OS Specific    AmigaOS    Linux    Windows    Mac OSX Miscellaneous    Announcement    Off Topic Showcase    Applications - Feedback and Discussion    PureFORM & JaPBe    TailBite