<?xml version="1.0" encoding="utf-8" standalone="yes"?>
<oembed>
  <author_name>Windymelt</author_name>
  <author_url>https://blog.hatena.ne.jp/Windymelt/</author_url>
  <blog_title>Lambdaカクテル</blog_title>
  <blog_url>https://blog.3qe.us/</blog_url>
  <categories>
    <anon>技術</anon>
    <anon>scala</anon>
  </categories>
  <description>Scalaのパターンマッチは変数を使って分割代入ができる。 val xs = 1 :: 2 :: 3 :: Nil xs match { case head :: tail =&gt; s&quot;head is $head&quot; // =&gt; &quot;head is 1&quot; case _ =&gt; &quot;not found&quot; } これはxsに対してまずhead :: tail という式にマッチが試みられ、headには1が、tailには2 :: 3 :: Nilがマッチするので、それぞれの変数に代入され、後続の式で使えるようになっている。 そしてs&quot;head is $head&quot;という式が評価されるが、ここではheadは1になって…</description>
  <height>190</height>
  <html>&lt;iframe src=&quot;https://hatenablog-parts.com/embed?url=https%3A%2F%2Fblog.3qe.us%2Fentry%2F2025%2F04%2F24%2F213019&quot; title=&quot;Scalaで変数に入った値そのものにパターンマッチさせるときは変数をバックティックで囲うとよい - Lambdaカクテル&quot; class=&quot;embed-card embed-blogcard&quot; scrolling=&quot;no&quot; frameborder=&quot;0&quot; style=&quot;display: block; width: 100%; height: 190px; max-width: 500px; margin: 10px 0px;&quot;&gt;&lt;/iframe&gt;</html>
  <image_url></image_url>
  <provider_name>Hatena Blog</provider_name>
  <provider_url>https://hatena.blog</provider_url>
  <published>2025-04-24 21:30:19</published>
  <title>Scalaで変数に入った値そのものにパターンマッチさせるときは変数をバックティックで囲うとよい</title>
  <type>rich</type>
  <url>https://blog.3qe.us/entry/2025/04/24/213019</url>
  <version>1.0</version>
  <width>100%</width>
</oembed>
