distinct(list) returns a new list with duplicate values removed. The first occurrence of each value is kept.
Signature
Example
Combine package lists from multiple variables and ensure no package appears twice before passing the list to a build command:["./cmd/api", "./cmd/worker", "./cmd/scheduler"] is the result, with the duplicate ./cmd/worker removed.
Notes
- Order is preserved based on first occurrence.
distinctworks on lists of any comparable element type.