<?xml version="1.0" encoding="utf-8" standalone="yes"?>
<rss version="2.0" xmlns:atom="http://www.w3.org/2005/Atom">
  <channel>
    <title>Comparison on Nalar</title>
    <link>https://nalar.dev/tags/comparison/</link>
    <description>Recent content in Comparison on Nalar</description>
    <generator>Hugo</generator>
    <language>en-us</language>
    <lastBuildDate>Thu, 10 Sep 2026 00:00:00 +0700</lastBuildDate>
    <atom:link href="https://nalar.dev/tags/comparison/index.xml" rel="self" type="application/rss+xml" />
    <item>
      <title>Compare Go Slices Lexicographically with slices.Compare</title>
      <link>https://nalar.dev/compare-go-slices-lexicographically-with-slices-compare/</link>
      <pubDate>Thu, 10 Sep 2026 00:00:00 +0700</pubDate>
      <guid>https://nalar.dev/compare-go-slices-lexicographically-with-slices-compare/</guid>
      <description>&lt;p&gt;Sometimes equality isn&amp;rsquo;t enough. You may need to order version components, compare path segments, choose which byte sequence comes first, or sort records by a slice-valued key. Writing that comparison by hand is straightforward, but the prefix case and the meaning of the return value are easy places to introduce small bugs.&lt;/p&gt;&#xA;&lt;p&gt;For slices whose element type is ordered, &lt;code&gt;slices.Compare&lt;/code&gt; provides the standard lexicographic comparison directly. It compares elements from left to right and, when all shared elements match, treats the shorter slice as smaller.&lt;/p&gt;</description>
    </item>
    <item>
      <title>Compare Go Slices with Custom Equality Using slices.EqualFunc</title>
      <link>https://nalar.dev/compare-go-slices-with-custom-equality-using-slices-equalfunc/</link>
      <pubDate>Thu, 10 Sep 2026 00:00:00 +0700</pubDate>
      <guid>https://nalar.dev/compare-go-slices-with-custom-equality-using-slices-equalfunc/</guid>
      <description>&lt;p&gt;Two slices can represent the same information without being directly comparable element by element. One side might contain structs while the other contains strings. Text may need case-insensitive comparison. IDs may arrive in different concrete types even though your application treats them as the same value.&lt;/p&gt;&#xA;&lt;p&gt;When equality depends on a rule rather than Go&amp;rsquo;s &lt;code&gt;==&lt;/code&gt; operator, &lt;code&gt;slices.EqualFunc&lt;/code&gt; puts that rule in one place and handles the slice traversal for you.&lt;/p&gt;</description>
    </item>
  </channel>
</rss>
