FUNCTION

list.retain_all_copy

function retain_all_copy(values: collection<-T>): list<T>

Return a new list whose elements are those found in both this list and the given collection, or in other words, the intersection of this list and the given collection.

Parameters

  • values — the other collection

Returns

a new list whose elements are the intersection of this list and the given collection

a.retain_all_copy(b) is equivalent to a & b, where a and b are lists.

Examples:

  • [1].retain_all_copy([1]) returns [1]
  • [1].retain_all_copy([2]) returns []
  • [1, 2, 3].retain_all_copy([2, 3, 4]) returns [2, 3]

Since

0.14.16

© 2026 Chromia