<?xml version="1.0" encoding="utf-8" standalone="yes"?>
<oembed>
  <author_name>JAPLJ</author_name>
  <author_url>https://blog.hatena.ne.jp/JAPLJ/</author_url>
  <blog_title>TopCoderとJ言語と時々F#</blog_title>
  <blog_url>https://japlj.hatenadiary.org/</blog_url>
  <categories>
    <anon>J</anon>
    <anon>F#</anon>
  </categories>
  <description>再帰の見本としてよく使われる階乗をJとF#で実装してみるテスト。 F#の場合 まずは普通に再帰的に実装してみる。 let rec fact = function 0 -&gt; 1 | n -&gt; n * fact (n-1) 次に末尾再帰の形で実装してみる。 let rec fact2 n res = if n = 0 then res else fact2 (n-1) (res * n) 最後に手続き的な実装もやってみる。 let fact3 n = let res = ref 1 for i in [1..n] do res := !res * i res [以下追記(2009/01/09 23…</description>
  <height>190</height>
  <html>&lt;iframe src=&quot;https://hatenablog-parts.com/embed?url=https%3A%2F%2Fjaplj.hatenadiary.org%2Fentry%2F20090109%2F1231499344&quot; title=&quot;階乗の実装 - TopCoderとJ言語と時々F#&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-01-09 20:09:04</published>
  <title>階乗の実装</title>
  <type>rich</type>
  <url>https://japlj.hatenadiary.org/entry/20090109/1231499344</url>
  <version>1.0</version>
  <width>100%</width>
</oembed>
