ecl-logo Documentation

UnsortedComplement

UnsortedComplement[expression1,expression2]outputExpression

returns the elements that are in expression1 but not in expression2, in the order they are present in expression1.

Details

    Input
    Output
    General Options
    Messages
  • MismatchedHeadsHeads `1` and `2` are not the same.

Examples

Basic Examples  (3)

Returns elements that are in the first argument but not in the second:

Returns its output in the same order as the first list:

Handles any expression, not just lists:

Additional Examples  (1)

Duplicate elements are not removed by default:

Options  (7)

DeleteDuplicates  (2)

Delete the duplicate items in the output:

Can delete duplicate items in any expression:

SameTest  (5)

Use an existing function to determine whether two items are the same:

Can be used to compare various forms of objects:

Use a pure function to determine whether two items are the same:

Find the complement of two associations by key:

Find the complement of two associations by value:

Messages  (1)

MismatchedHeads  (1)

An error is shown if the heads of the two input expressions do not match: