Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 9 additions & 0 deletions lib/goidiomatic/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -317,6 +317,15 @@ Removes duplicates, preserving first-seen order. Returns a **list** for a list o

A mutable list input remains mutable after the call, including when an element cannot be hashed.

**Known limitation:** `distinct` currently compares hashes alone, so unequal values with the same hash can be dropped: `distinct([1, 4294967297])` returns `[1]`. The equality fix in [#198](https://github.com/1set/starlet/pull/198) is not merged. For native integers, a Starlark dict compares keys and preserves first-seen order:

```python
values = [1, 4294967297, 1]
unique = {value: None for value in values}.keys()
print(unique)
# Output: [1, 4294967297]
```

```python
load("go_idiomatic", "distinct")
print(distinct([1, 2, 2, 3, 3, 3]), distinct((1, 2, 2, 3)))
Expand Down
Loading