Skip to content

Set, Comparison, And Boolean OperationsπŸ”—

Set OperationsπŸ”—

Table 1: Set operations
Operation Meaning HALCON operator
difference(t1,t2) difference set tuple_difference
intersection(t1,t2) intersection set tuple_intersection
symmdiff(t1,t2) symmetric difference set tuple_symmdiff
union(t1,t1) union set tuple_union

Comparison OperationsπŸ”—

Table 2: Comparison operations
Operation Meaning HALCON operator Alternative notation
t1 < t2 less than tuple_less
t1 > t2 greater than tuple_greater
t1 <= t2 less or equal tuple_less_equal
t1 >= t2 greater of equal tuple_greater_equal
t1 == t2 equal tuple_equal t1 = t2 (legacy)
t1 != t2 not equal tuple_not_equal t1 # t2 (legacy)

Example

Table 3: Examples for the comparison of tuples
1st Operand Operation 2nd Operand Result
1 == 1.0 true
[] == [] true
'' == [] false
[1,'2'] == [1,2] false
[1,2,3] == [1,2] false
[4711,'Hugo'] == [4711,'Hugo'] true
'Hugo' == 'hugo' false
2 > 1 true
2 > 1.0 true
[5,4,1] > [5,4] true
[2,1] > [2,0] true
true > false true
'Hugo' < 'hugo' true

Elementwise Comparison OperationsπŸ”—

Table 4: Elementwise comparison operations
Operation Meaning HALCON operator Alternative notation
t1 [<] t2 less than tuple_less_elem
t1 [>] t2 greater than tuple_greater_elem
t1 [<=] t2 less or equal tuple_less_equal_elem
t1 [>=] t2 greater of equal tuple_greater_equal_elem
t1 [==] t2 equal tuple_equal_elem t1 [=] t2 (legacy)
t1 [!=] t2 not equal tuple_not_equal_elem t1 [#] t2 (legacy)

Example

Table 5: Examples for the elementwise comparison of tuples
1st Operand Operation 2nd Operand Result
[1,2,3] [<] [3,2,1] [1,0,0]
['a','b','c'] [==] 'b' [0,1,0]
['a','b','c'] [<] ['b'] [1,0,0]

Boolean OperationsπŸ”—

Table 6: Boolean operations
Operation Meaning HALCON operator
l1 and l2 logical β€˜and’ tuple_and
l1 xor l2 logical β€˜xor’ tuple_xor
l1 or l2 logical β€˜or’ tuple_or
not l negation tuple_not