GeneralComp

Compare sequences.


Syntax

GeneralComp

graphics/GeneralComp.png

Expr Expr

Description

A general comparison differs from a value comparison in that operands may be sequences of any length with implicit existential quantification. Given two sequences A and B the result is determined as follows:

  • A = B is true if and only if the value comparison a eq b is true for some item a in A and some b in B. Otherwise it is false.

  • A != B is true if and only if the value comparison a ne b is true for some item a in A and some b in B.

  • A < B is true if and only if the value comparison a lt b is true for some item a in A and some b in B.

  • A <= B is true if and only if the value comparison a lt b is true for some item a in A and some b in B.

  • A > B is true if and only if the value comparison a gt b is true for some item a in A and some b in B.

  • A >= B is true if and only if the value comparison a ge b is true for some item a in A and some b in B.

Example

  • For all books check if there is an author with surname "Stevens":

    for $b in input()/bib/book
    return $b/author/last = "Stevens"

    Given the sample data this comparison is true for two instances of book, but false for the other ones.

Related Syntax Construct

The following construct(s) refer to this construct:

This construct is also related to the following construct(s):

ValueComp