Upgrade to Pro
— share decks privately, control downloads, hide ads and more …
Speaker Deck
Features
Speaker Deck
PRO
Sign in
Sign up for free
Search
Search
不動点コンビネータって何ぞ #TechLunch
Search
Livesense Inc.
PRO
April 23, 2014
Technology
0
120
不動点コンビネータって何ぞ #TechLunch
2012/02/15(水) @ Livesense TechLunch
発表者:春日 太志
Livesense Inc.
PRO
April 23, 2014
Tweet
Share
More Decks by Livesense Inc.
See All by Livesense Inc.
27新卒_Webエンジニア職採用_会社説明資料
livesense
PRO
0
310
株式会社リブセンス・転職会議 採用候補者様向け資料
livesense
PRO
0
17
株式会社リブセンス 会社説明資料(報道関係者様向け)
livesense
PRO
0
1.4k
データ基盤の負債解消のためのリプレイス
livesense
PRO
0
400
26新卒_総合職採用_会社説明資料
livesense
PRO
0
9k
株式会社リブセンス会社紹介資料 / Invent the next common.
livesense
PRO
1
28k
26新卒_Webエンジニア職採用_会社説明資料
livesense
PRO
1
12k
中途セールス職_会社説明資料
livesense
PRO
0
250
EM候補者向け転職会議説明資料
livesense
PRO
0
120
Other Decks in Technology
See All in Technology
SEQUENCE object comparison - db tech showcase 2025 LT2
nori_shinoda
0
140
生成AI開発案件におけるClineの業務活用事例とTips
shinya337
0
260
Delegating the chores of authenticating users to Keycloak
ahus1
0
140
開発生産性を組織全体の「生産性」へ! 部門間連携の壁を越える実践的ステップ
sudo5in5k
2
7.1k
KubeCon + CloudNativeCon Japan 2025 Recap by CA
ponkio_o
PRO
0
300
Reach American Airlines®️ Instantly: 19 Calling Methods for Fast Support in the USA
flyamerican
1
170
生成AI時代の開発組織・技術・プロセス 〜 ログラスの挑戦と考察 〜
itohiro73
1
460
Delta airlines®️ USA Contact Numbers: Complete 2025 Support Guide
airtravelguide
0
340
関数型プログラミングで 「脳がバグる」を乗り越える
manabeai
1
190
品質と速度の両立:生成AI時代の品質保証アプローチ
odasho
1
340
ビズリーチにおけるリアーキテクティング実践事例 / JJUG CCC 2025 Spring
visional_engineering_and_design
1
120
Tokyo_reInforce_2025_recap_iam_access_analyzer
hiashisan
0
180
Featured
See All Featured
Product Roadmaps are Hard
iamctodd
PRO
54
11k
The Cult of Friendly URLs
andyhume
79
6.5k
How to Create Impact in a Changing Tech Landscape [PerfNow 2023]
tammyeverts
53
2.9k
RailsConf & Balkan Ruby 2019: The Past, Present, and Future of Rails at GitHub
eileencodes
138
34k
The Pragmatic Product Professional
lauravandoore
35
6.7k
The Success of Rails: Ensuring Growth for the Next 100 Years
eileencodes
45
7.5k
Building Applications with DynamoDB
mza
95
6.5k
Optimizing for Happiness
mojombo
379
70k
RailsConf 2023
tenderlove
30
1.1k
Music & Morning Musume
bryan
46
6.6k
Site-Speed That Sticks
csswizardry
10
690
Embracing the Ebb and Flow
colly
86
4.7k
Transcript
@bar_̲row 2012年年02⽉月15⽇日 不不動点コンビネータ って何ぞ? Livesense Inc. 1
⽬目次 Livesense Inc. 2 1. 解説ブログ記事の紹介 2. 呼び⽅方⼀一覧 3. 不不動点とは
4. 不不動点コンビネータとは 5. Y-‐‑‒Combinator とは 6. Y-‐‑‒Combinator を Common Lisp で
1-‐‑‒1. 解説ブログ記事の紹介 Livesense Inc. 3 Y コンビネータって何? -‐‑‒IT戦記-‐‑‒ id:amachang http://d.hatena.ne.jp/amachang/20080124/1201199469
TuringとChurchの狭間で -‐‑‒404 Blog Not Found-‐‑‒ @dankogai http://blog.livedoor.jp/dankogai/archives/50458503.html
1-‐‑‒2. 解説ブログの紹介 Livesense Inc. 4 ラムダ計算とチューリングマシンの違い –きしだのはてな-‐‑‒ id:nowokay http://d.hatena.ne.jp/nowokay/20090413
2. 呼び⽅方⼀一覧 Livesense Inc. 5 ・不不動点コンビネータ ・不不動点結合⼦子(fixed point combinator) ・不不動点演算⼦子(fixed
point operator) ・パラドキシカル結合⼦子(paradoxical combinator)
3. 不不動点とは Livesense Inc. 6 0と1は f(x) = x^2 の不不動点
f(x) = x を満たす x ⼀一階関数の不不動点は第⼀一級値 first-‐‑‒order function first-‐‑‒class value ⾼高階関数の不不動点は関数
4. 不不動点コンビネータとは Livesense Inc. 7 関数の不不動点を求める⾼高階関数 任意の関数fの不不動点pを返す関数g p = g(f)
f(p) = p f(g(f)) = g(f)
5-‐‑‒1. Y-‐‑‒Combinator とは Livesense Inc. 8 型なしラムダ計算の不不動点コンビネータの⼀一つ Haskell Brooks Curry
1900/09/12 – 1982/09/01 Y Combinator LLC ある関数を与えるとそれを再帰する関数を返す関数
5-‐‑‒2. Y-‐‑‒Combinator とは Livesense Inc. 9 Y g = (λf.(λx.f(x
x))(λx.f(x x))) g = (λx.g(x x))(λx.g(x x)) = (λy.g(y y))(λx.g(x x)) = g((λx.g(x x))(λx.g(x x))) = g(Y g) Y = λf.(λx.f(x x))(λx.f(x x))
6-‐‑‒1. Y-‐‑‒Combinator を Common Lisp で Livesense Inc. 10 //
֊Λฦ͢ Javascript ؔྫʢ෭࡞༻͋Γʣ var hoge = function (n) { return (n == 1) ? 1 : n * arguments.callee(n - 1); }; hoge(3); // => 6 var fuga = function f(n) { return (n == 1) ? 1 : n * f(n - 1); }; fuga(3); // => 6
6-‐‑‒2. Y-‐‑‒Combinator を Common Lisp で Livesense Inc. 11 //
Javascript Ͱ࣮ͨ͠ Y Combinator var Y = function (f) { return (function (g) { return function (m) { return f(g(g))(m); }; })(function (g) { return function (m) { return f(g(g))(m); }; }); };
6-‐‑‒3. Y-‐‑‒Combinator を Common Lisp で Livesense Inc. 12 //
֊ܭࢉͰ Y Combinator Λ͏ Y(function (fact) { return function (n) { return (n == 1) ? 1 : n * fact(n - 1); }; })(3); // => 6 // Y-Combinator ؔΛҾͰͤΔΑ͏ʹϥοϓ͢Εɺ // ແ໊͚ؔͩͰಈ͘͜ͱʹͳΓ·͢ɻ
6-‐‑‒4. Y-‐‑‒Combinator を Common Lisp で Livesense Inc. 13 ;
֊Λฦ͢ (defun fact (n) (if (= n 1) 1 (* n (fact (- n 1))))) これを無名再帰まで持っていく...
6-‐‑‒5. Y-‐‑‒Combinator を Common Lisp で Livesense Inc. 14 ;
֊Λฦ͢ (funcall ((lambda (f) ((lambda (g) (lambda (m) (funcall (funcall f (funcall g g)) m))) (lambda (g) (lambda (m) (funcall (funcall f (funcall g g)) m))))) (lambda (fact) (lambda (n) (if (= n 1) 1 (* n (funcall fact (- n 1))))))) 3)