functx:are-distinct-values

Whether all the values in a sequence are distinct

Description

The functx:are-distinct-values function returns true if all of the values in the sequence are distinct; i.e., no one value appears more than once in the sequence. Distinctness is based on type equality.

Parameters

Description

seq:string()

the sequence of values

Examples

XPath

Results

functx:are-distinct-values( (1,2,1,3))

false

functx:are-distinct-values( (1,2,1,3,2.0))

false

functx:are-distinct-values( (1,2,3) )

true

In a generator

Copy the snippet below and paste it in Freemapper, under a language node inside the generators element. Each line of the pattern prints the result of one example; to see them, run mi generate <project> <language> example-functx-are-distinct-values.

[e] example-functx-are-distinct-values
    [e] start
        [e] match
            [v] /
        [e] body
            [e] write-pattern
                [v] examples
    [e] patterns
        [e] examples
            [v] E01: {{ functx:are-distinct-values( (1,2,1,3)) }}
            [v] E02: {{ functx:are-distinct-values( (1,2,1,3,2.0)) }}
            [v] E03: {{ functx:are-distinct-values( (1,2,3) ) }}

See Also