How to sort instances by property value

E

Edis

Guest
Hi GURUs
I have long list (>5000) of instances, e.g. pcapacitors. I want to
sort this list by capacitor value, e.g. pc~>c.
Are any ready or built-in functions to do that.
Thanks
 
Edis wrote, on 09/18/09 15:45:
Hi GURUs
I have long list (>5000) of instances, e.g. pcapacitors. I want to
sort this list by capacitor value, e.g. pc~>c.
Are any ready or built-in functions to do that.
Thanks
sorted=sort(instances lambda((a b) a~>c < b~>c))

or if the C value is a string, you would probably best to do:

sorted=sort(instances lambda((a b) cdfParseFloatString(a~>c) <
cdfParseFloatString(b~>c)))

Or you could define your own comparison function and just pass that to the
second argument to the sort function.

Best Regards,

Andrew.
 

Welcome to EDABoard.com

Sponsor

Back
Top