forum.vdsworld.com Forum Index forum.vdsworld.com
Visit VDSWORLD.com
 
 FAQFAQ   SearchSearch   MemberlistMemberlist   UsergroupsUsergroups   RegisterRegister 
 ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 


Sorting lists

 
Post new topic   Reply to topic    forum.vdsworld.com Forum Index -> General Help
View previous topic :: View next topic  
Author Message
Hooligan
VDS Developer
VDS Developer


Joined: 28 Oct 2003
Posts: 480
Location: California

PostPosted: Tue Dec 14, 2004 12:47 pm    Post subject: Sorting lists Reply with quote

When running the following code, I would have thought both lists would be in the same order.
Code:
  list create,1
  list create,2
  %a = 32
  repeat
  list add,1,%a @tab() @chr(%a)
  list add,2,@chr(%a) @tab() %a
  %a = @succ(%a)
  until @equal(%a,255)
  list savefile,1,c:\ascii.txt
  list sort,2
  list savefile,2,c:\sorted_ascii.txt


Am I over looking something obvious? Anyone have any ideas?
Hooligan Confused

_________________
Hooligan

Why be normal?
Back to top
View user's profile Send private message
Dr. Dread
Professional Member
Professional Member


Joined: 03 Aug 2001
Posts: 1065
Location: Copenhagen, Denmark

PostPosted: Tue Dec 14, 2004 1:04 pm    Post subject: Reply with quote

VDS does not sort in straight ASCII order. It rather tries to use a more linguistically correct sort order
so that ú, u, and U are all placed together between T and V even though they are far apart in the ASCII
char table.

BTW, sorting text strings is a really complicated matter - ask any lexicographer..

Greetz
Dread

_________________
~~ Alcohol and calculus don't mix... Don't drink and derive! ~~

String.DLL * advanced string processing
Back to top
View user's profile Send private message
Hooligan
VDS Developer
VDS Developer


Joined: 28 Oct 2003
Posts: 480
Location: California

PostPosted: Tue Dec 14, 2004 1:24 pm    Post subject: Reply with quote

I had no idea...
Oh, well... Nothing @asc() can't cure!
Ask any mathamatician! Wink

Thanks Dread,
Hooligan

_________________
Hooligan

Why be normal?
Back to top
View user's profile Send private message
Dr. Dread
Professional Member
Professional Member


Joined: 03 Aug 2001
Posts: 1065
Location: Copenhagen, Denmark

PostPosted: Tue Dec 14, 2004 4:15 pm    Post subject: Reply with quote

Hooligan wrote:
Oh, well... Nothing @asc() can't cure!
Ask any mathamatician! Wink


He-he. True enough. However if you use values from @asc() for sorting, you may run into another little issue.

VDS does not sort numbers in "natural order", so sorted output will be like this:
1
12
18
2
23
and not:
1
2
12
18
23

Greetz
Dread

_________________
~~ Alcohol and calculus don't mix... Don't drink and derive! ~~

String.DLL * advanced string processing
Back to top
View user's profile Send private message
Hooligan
VDS Developer
VDS Developer


Joined: 28 Oct 2003
Posts: 480
Location: California

PostPosted: Tue Dec 14, 2004 5:23 pm    Post subject: Reply with quote

That's what I get for drinking and deriving!
_________________
Hooligan

Why be normal?
Back to top
View user's profile Send private message
Display posts from previous:   
Post new topic   Reply to topic    forum.vdsworld.com Forum Index -> General Help All times are GMT
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum
You can attach files in this forum
You can download files in this forum

Twitter@vdsworld       RSS

Powered by phpBB © 2001, 2005 phpBB Group