Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Do nesting level
Message
From
17/09/2001 05:04:25
 
 
To
17/09/2001 04:58:53
Jimi Lee
Pop Electronic Products Ltd.
Hong Kong, Hong Kong
General information
Forum:
Visual FoxPro
Category:
Coding, syntax & commands
Miscellaneous
Thread ID:
00557186
Message ID:
00557207
Views:
25
This message has been marked as a message which has helped to the initial question of the thread.
Hi!

Yep.

MyObjects(i,2) = padl(val(m.cObjValue),4,"0")+substr(m.cObjValue,len(val(m.cObjValue))+1)

This will make them all like
0001, 0002, 0002A, 0003, 0003A, 0003B, 0010, 0010A...etc.

and in character comparison it will be "0002"<"0010".

HTH.


>hi Vlad,
>
>i didn't use the asort() because I'm sorting something like:
>1, 2, 2A, 3, 3A, 3B, 10, 10A...etc.
>
>since 2A 3A are valid, I cannot use integer but strings, but at the same time 10 must be larger than 2 that for string comparsion foxpro would think 2 is larger... I dunno how to fix this so I used a custom sorting..
>
>any idea?
>
>Jimi
>
>>Hi!
>>
>>Any recursive function could be re-written to use a loop instead of recursive call.
>>
>>However, I'm wondered - WHY not use ASORT() function????????
>>dimension MyObjects(nObjectsCount,2)
>>for i=1 to nObjectsCount
>> MyObjects(i,1) = ... && some object reference
>> MyObjects(i,2) = ... && value used for comparison for sorting
>>endfor
>>
>>ASORT(MyObjects,2)
>>
>>And thats all.
>>This way should be MUCH more quick then just a custom sorting algorithm.
>>
>>HTH.
>>
>>Make array 2-dimensioned with 2 columns. One contains object reference. Another column contains value which you use for sorting. Then use ASORT(aArray,)
>>
>>>I have wrote a function to quick-sort' an array of objects, but when the array is a bit larger (~600), I receive an "Allowed DO nesting level exceeded." error message.
>>>
>>>I do not have any do-loop included in another do-loop, but maybe it still counted when a do-loop is included in my recursive function...
>>>
>>>Is it posible to remove this limitation, or must I rewrite my recursive function?
>>>
>>>Thanks,
>>>Jimi
Vlad Grynchyshyn, Project Manager, MCP
vgryn@yahoo.com
ICQ #10709245
The professional level of programmer could be determined by level of stupidity of his/her bugs

It is not appropriate to say that question is "foolish". There could be only foolish answers. Everybody passed period of time when knows nothing about something.
Previous
Next
Reply
Map
View

Click here to load this message in the networking platform