E
Edward
Guest
Running the following code inside a function gets me screwy results.
Some windows are dropped out of the list while others stay and no
sorting occurs. I can't seem to run this code from the CIW, because
I get the following error:
*Error* get/getq: first arg must be either symbol, list, defstruct or
user type - 4
(setq thiswinList '(window:3 window:4 window:5 window:6 window:7))
(sort thiswinList
(lambda (x y)
(alphalessp
x~>cellView~>viewName
y~>cellView~>viewName)))
The results are even worse when I attempt to reverse the sort by
transposing the arguments for alphalessp. Then the function returns a
list with only one element, the first element.
It would be nice to know why this is happening. I'm assuming it has
to do with the recursive nature of the operation. But more to the
point, what code can accomplish what I want to do? I'm trying to
take a list of windows and sort based on the viewName such that all
schematic views are at the beginning of the list and all layout views
are at the end. Hopefully the answer would be something easily
generalizable for any list of window-IDs or dbObjs on any property.
Thanks in advance,
Edward
Some windows are dropped out of the list while others stay and no
sorting occurs. I can't seem to run this code from the CIW, because
I get the following error:
*Error* get/getq: first arg must be either symbol, list, defstruct or
user type - 4
(setq thiswinList '(window:3 window:4 window:5 window:6 window:7))
(sort thiswinList
(lambda (x y)
(alphalessp
x~>cellView~>viewName
y~>cellView~>viewName)))
The results are even worse when I attempt to reverse the sort by
transposing the arguments for alphalessp. Then the function returns a
list with only one element, the first element.
It would be nice to know why this is happening. I'm assuming it has
to do with the recursive nature of the operation. But more to the
point, what code can accomplish what I want to do? I'm trying to
take a list of windows and sort based on the viewName such that all
schematic views are at the beginning of the list and all layout views
are at the end. Hopefully the answer would be something easily
generalizable for any list of window-IDs or dbObjs on any property.
Thanks in advance,
Edward