Join two lists of dicts (Dicts1 and Dicts2) on Key.
Each pair D1-D2 from Dicts1 and Dicts2 that have
the same (==
) value for
Key creates a new dict D with the union of the keys from D1
and D2, provided D1 and D2 to not have conflicting values for some key.
For example:
?- DL1 = [r{x:1,y:1},r{x:2,y:4}],
DL2 = [r{x:1,z:2},r{x:3,z:4}],
dicts_join(x, DL1, DL2, DL).
DL = [r{x:1, y:1, z:2}, r{x:2, y:4}, r{x:3, z:4}].
- Errors
existence_error(key, Key, Dict)
if a dict in Dicts1
or Dicts2 does not contain Key.