Hi, everyone. I just found something not normal with Skip list. Here I am using Skip list to save the Absolute number of object. Before saving in skip list, everything alright, the number is same as in module. But after getting the number from Skip list, the key (absolute number) is sorted!!!!
Object o
Skip sk = createString
int num
string str
for o in current Module do{
if(isSelected(o)){
str = o."Absolute Number"
put(sk, str, str)
print "object abs: "str "\n"
}
}
for str in sk do{
str = (string key sk)
print str "\n"
}
Result:
What happend here? Can anyone please help? I want to get the absolute number from skip list same order as in module Jonny Tim - Thu Jan 17 10:26:34 EST 2019 |
Re: Skip list auto sorting the key??? yes, that's one of the features of Skip lists, in fact it is the preferred way to sort data in DXL. Alternatives: - use a Skip with integer as key (Skip sk = create), increase an index variable in your loop, use the index as key and str as value - use an array - use an Array |
Re: Skip list auto sorting the key??? Mike.Scharnow - Thu Jan 17 10:34:42 EST 2019 yes, that's one of the features of Skip lists, in fact it is the preferred way to sort data in DXL. Alternatives: - use a Skip with integer as key (Skip sk = create), increase an index variable in your loop, use the index as key and str as value - use an array - use an Array I always thought skip list doesn't sort key. Thank you, Mike. It is really helpful. |
Re: Skip list
Scharnow is correct. [3] Do not put an "array" in a Skip. An Array is OK.
[4] There are only 3 people in the world who can use "addr_" bla bla tricks with Skip's; I'm not one of them. [1] Integer and Real Keys are straight forward
[2] A string Key does cause problems. Lexigraphic sorts are left to right. If you put string "1224" into your skip, it will be retrieved BEFORE 177 in your example. for obj in mod do { put(skp, Sequencer++, obj) } -Louie |