sort_list()

Returns a new list with members of a given list in sorted order. If the compare function is not given and the list is homogeneous, a built-in function will be applied if:

For other cases, a compare() function must be supplied. The compare() function is called with two member values as the argument and must return a value greater than, equal to, or less than zero, depending on whether the first member is greater than, equal to, or less than the second member. If the first argument is not a list, the function fails and reports an error.

Syntax:

sort_list(list, [, func]);

where

list is a list to be sorted.

func is optional. Address of function to perform member comparison.

Example:

This example redefines l to the list 1, 2, 3, 4, 9.

decl l = list(2, 4, 1, 3, 9);
defun my_compare(first, second)
{
    decl neg;
    if (first < second)
        neg = -1;
    else if (first > second)
        neg = 1;
    else 
        neg = 0;
    return (neg);
}
l = sort_list(l, my_compare);

Download Example File:

The following link(s) lead to the Agilent EEsof EDA Knowledge center website. You will need to register at this site with a valid support contract to download an example file.

Netlist with Node Names

Where Used:

Measurement Expressions (Data Display equations and Schematic MeasEqns), Schematic, Layout, Simulation, GUI

 

Privacy Statement  | Terms of Use  | Legal | Contact Us  | © Agilent 2000-2008 

Contents
Additional Resources