<?xml version="1.0" encoding="utf-8" standalone="yes"?>
<rss version="2.0" xmlns:atom="http://www.w3.org/2005/Atom">
  <channel>
    <title>Deduplication on Nalar</title>
    <link>https://nalar.dev/tags/deduplication/</link>
    <description>Recent content in Deduplication on Nalar</description>
    <generator>Hugo</generator>
    <language>en-us</language>
    <lastBuildDate>Fri, 11 Sep 2026 00:00:00 +0700</lastBuildDate>
    <atom:link href="https://nalar.dev/tags/deduplication/index.xml" rel="self" type="application/rss+xml" />
    <item>
      <title>Remove Adjacent Duplicates from Go Slices with slices.Compact</title>
      <link>https://nalar.dev/remove-adjacent-duplicates-from-go-slices-with-slices-compact/</link>
      <pubDate>Fri, 11 Sep 2026 00:00:00 +0700</pubDate>
      <guid>https://nalar.dev/remove-adjacent-duplicates-from-go-slices-with-slices-compact/</guid>
      <description>&lt;p&gt;Duplicate values often arrive in runs: repeated status events, sorted IDs, or adjacent tokens produced by a parser. When only consecutive duplicates need to disappear, &lt;code&gt;slices.Compact&lt;/code&gt; handles the operation without a handwritten loop.&lt;/p&gt;&#xA;&lt;p&gt;The distinction is specific. &lt;code&gt;slices.Compact&lt;/code&gt; collapses adjacent equal values; it doesn&amp;rsquo;t search the entire slice for duplicates. It also modifies the slice&amp;rsquo;s backing storage, so callers need to account for aliasing.&lt;/p&gt;&#xA;&lt;h2 id=&#34;remove-adjacent-duplicates-with-slicescompact&#34;&gt;Remove adjacent duplicates with slices.Compact&lt;/h2&gt;&#xA;&lt;p&gt;Pass a slice whose element type is comparable and assign the returned slice:&lt;/p&gt;</description>
    </item>
  </channel>
</rss>
