<?xml version="1.0" encoding="utf-8" standalone="yes"?>
<oembed>
  <author_name>Naotsugu</author_name>
  <author_url>https://blog.hatena.ne.jp/Naotsugu/</author_url>
  <blog_title>A Memorandum</blog_title>
  <blog_url>https://blog1.mammb.com/</blog_url>
  <categories>
    <anon>Scala</anon>
  </categories>
  <description>foldLeft 初期値を1として、arrの和を得る。 val arr = List(2, 3, 4) arr.foldLeft(1){(x, y) =&gt; x + y} 1 + 2 + 3 + 4 で 10 となる。短く書くと、 arr.foldLeft(1)( _ + _ ) foldLeft には /: というエイリアスがあり、以下のように書ける。 (1 /: arr){_ + _} foldRight foldRight では適用の順番が逆になる。 val arr = List(2, 3, 4) arr.foldRight(1)( _ + _ ) 4+1 3+(4+1) 2+(3+(4+…</description>
  <height>190</height>
  <html>&lt;iframe src=&quot;https://hatenablog-parts.com/embed?url=https%3A%2F%2Fblog1.mammb.com%2Fentry%2F20100523%2F1274636814&quot; title=&quot;foldLeft と foldRight のエイリアス - A Memorandum&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>2010-05-23 02:46:54</published>
  <title>foldLeft と foldRight のエイリアス</title>
  <type>rich</type>
  <url>https://blog1.mammb.com/entry/20100523/1274636814</url>
  <version>1.0</version>
  <width>100%</width>
</oembed>
