<?xml version="1.0" encoding="utf-8" standalone="yes"?>
<oembed>
  <author_name>Kazumi007</author_name>
  <author_url>https://blog.hatena.ne.jp/Kazumi007/</author_url>
  <blog_title>Kazumi007の日記</blog_title>
  <blog_url>https://kazumi007.hatenadiary.org/</blog_url>
  <categories>
    <anon>Scala</anon>
  </categories>
  <description>最近Scalaで遊んでいるんだけど、結構おもしろいです。わくわくするような機能はないのですが、なんというかいろんな機能が絶妙なバランスでミックスされている感じがいいです。お気に入りは、動的にmix-inを定義する関数なんかですね。implicitメソッドを用いて、暗黙の型変換を利用した例を紹介します。その例としてRubyのtimesメソッドを実現してみます。Rubyのtimesメソッドは、n.timesでn回ブロックを評価するというメソッドです。まずは、irbで実験してみます。 &gt;&gt; 5.times{print &quot;hello\n&quot;} hello hello hello hello hello …</description>
  <height>190</height>
  <html>&lt;iframe src=&quot;https://hatenablog-parts.com/embed?url=https%3A%2F%2Fkazumi007.hatenadiary.org%2Fentry%2F20090405&quot; title=&quot;ScalaでRubyのtimesメソッドを実現する - Kazumi007の日記&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>2009-04-05 00:00:00</published>
  <title>ScalaでRubyのtimesメソッドを実現する</title>
  <type>rich</type>
  <url>https://kazumi007.hatenadiary.org/entry/20090405</url>
  <version>1.0</version>
  <width>100%</width>
</oembed>
