liveBook · Manning

Distinct keyword

A distinct operation eliminates duplicate values, elements, or rows from a result, retaining one occurrence of each unique item.

How 4 Manning books explain it

Clojure: The Essential Reference

distinct is a Clojure function or transducer that removes repeated items from a collection while preserving the first occurrence of each item.

How it is used
Removes repeated values across a collection while retaining their first occurrence.
How deep it goes
Defines input and output contracts, exceptions, laziness, and transducer use, then contrasts adjacent-only duplicate removal.
Examples
Shows numeric sequences, deduplicated votes grouped by user, and a composed transducer over generated ranges.
What you can do after
Apply it via Clojure’s distinct or its transducer form to retain the first occurrence of each value.

Read how Clojure: The Essential Reference explains distinct keyword →

Spring in Action, Sixth Edition

distinct is a Project Reactor operator that emits each distinct source element only once.

How it is used
Filters repeated values from a Flux so the resulting Flux publishes each value only once.
How deep it goes
Defines the operator through its output and a verified example, without explaining its internals.
Examples
Tests a Flux of animal names in which repeated "dog" and "bird" values appear only once in the expected output.
What you can do after
Apply it via Project Reactor’s distinct() and verify the resulting Flux with StepVerifier.

Read how Spring in Action, Sixth Edition explains distinct keyword →

Statistics Slam Dunk

The distinct() function from dplyr returns rows containing unique combinations of selected columns from a tabular object.

How it is used
Identifies unique player-season-position combinations while standardizing tabular NBA data.
How deep it goes
Demonstrates selected-column deduplication and record counting, then defers statistical aggregation to group_by() and summarize().
Examples
Uses dat1 and the Year, Player, Pos columns to count 12,239 unique combinations amid NBA multi-team records.
What you can do after
Apply it via dplyr to inspect unique combinations before deciding how to remove or aggregate duplicate records.

Read how Statistics Slam Dunk explains distinct keyword →

DuckDB in Action

The DISTINCT keyword removes duplicate rows from the result produced by a query projection.

How it is used
Filters duplicate projected rows before inserting a unique set from another relation.
How deep it goes
Defines uniqueness across all selected columns and demonstrates it in a remote CSV-to-table INSERT.
Examples
Uses duplicated systems.csv records and inserts DISTINCT system_id and system_public_name pairs into systems.
What you can do after
Apply DISTINCT in SQL to prevent duplicate projected rows from causing insertion failures.

Read how DuckDB in Action explains distinct keyword →

Related concepts

These guides are generated from the text of Manning books by Manning's knowledge graph and link to the sections they draw on. The full books are available on liveBook and at manning.com.