CML Reference Guide

Chapter 4.5:  Comparisons & Logic

[TOP] [UP] [PREV] [NEXT]

$and(a b ...)
Evaluates to the logical "and" of a and b and ...  May have any number of arguments.

$or(a b ...)
Evaluates to the logical "or" of a and b and ...  May have any number of arguments.

$not(a)
Evaluates to the logical negation of a.

$equal(x y)
If x and y are identical (they may be numbers or strings), evaluates to "1".  Otherwise it is "0".  Note: $equal() expects that x and y do not contain blanks; if they do, the results are unpredictable.  If you must compare multi-word strings, see $quote().

$not_equal(x y)
Reverse of $equal().

$empty(str)
Evaluates to "1" if str is completely empty, and "0" otherwise.

$not_empty(str)
Evalutates to "1" if str is not empty, and "0" if it is completely empty.

$if(a b c)
If a is true, evaluates to b.  Otherwise, evaluates to c.  The classic triadic "if then else" operator.  Arguments a and b must be only one word; c may be any length.

$gen_sort(direction words...)
Sorts the list of words in ascending (direction > 0) alphabetical order, or descending (direction < 0) alphabetical order.  Evaluates to a list of indices to the original list, in sorted order.  I.e., $gen_sort (1 a c b) evaluates to "1 3 2".

$num_sort(direction numbers...)
If direction is > 0, evaluates to the list of numbers, sorted in ascending numerical order.  If direction is < 0, descending numerical order is used.

$triplet_sort(direction triplet_list...)
If direction is > 0, evaluates to the list of item triplets, sorted in ascending numerical order.  If direction is < 0, descending numerical order is used.  In this case, numerical order means the conference number is considered first, then the item number, and finally the response number.

$item_sort(direction code triplet_list...)
Evaluates to a sorted triplet list of items.  If direction is > 0, sorting is done in ascending order; if < 0, descending order.

Code selects the property used to sort the items.  A value of 1 sorts the items alphabetically by title.  A value of 2 sorts alphabetically by the author's full name.  A value of 3 sorts by the date of the last (undeleted) response to the item.  (For code 1 and 2, the items must all be in the same conference, or the results will be unpredictable.)