WLJS LogoWLJS Notebook

KeyComplement

KeyComplement[{assocall, assoc1, assoc2, ...}] generates an association in which only elements whose keys appear in assocall but not in any of the associ are retained.

Examples

Find complement keys:

KeyComplement[{<|a -> 1, b -> 2, c -> 3|>, <|a -> 4|>}]
(* <|b -> 2, c -> 3|> *)

Multiple exclusions:

KeyComplement[{<|a -> 1, b -> 2, c -> 3, d -> 4|>, <|a -> 0|>, <|c -> 0|>}]
(* <|b -> 2, d -> 4|> *)

Please visit the official Wolfram Language Reference for more details.

On this page