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
140
不動点コンビネータって何ぞ #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
2.5k
株式会社リブセンス・転職会議 採用候補者様向け資料
livesense
PRO
0
53
株式会社リブセンス 会社説明資料(報道関係者様向け)
livesense
PRO
0
1.5k
データ基盤の負債解消のためのリプレイス
livesense
PRO
0
440
26新卒_総合職採用_会社説明資料
livesense
PRO
0
11k
株式会社リブセンス会社紹介資料 / Invent the next common.
livesense
PRO
1
38k
26新卒_Webエンジニア職採用_会社説明資料
livesense
PRO
1
13k
中途セールス職_会社説明資料
livesense
PRO
0
270
EM候補者向け転職会議説明資料
livesense
PRO
0
130
Other Decks in Technology
See All in Technology
プラットフォーム転換期におけるGitHub Copilot活用〜Coding agentがそれを加速するか〜 / Leveraging GitHub Copilot During Platform Transition Periods
aeonpeople
1
210
株式会社ログラス - 会社説明資料【エンジニア】/ Loglass Engineer
loglass2019
4
65k
新規プロダクトでプロトタイプから正式リリースまでNext.jsで開発したリアル
kawanoriku0
1
160
要件定義・デザインフェーズでもAIを活用して、コミュニケーションの密度を高める
kazukihayase
0
120
20250913_JAWS_sysad_kobe
takuyay0ne
2
240
これでもう迷わない!Jetpack Composeの書き方実践ガイド
zozotech
PRO
0
1k
現場で効くClaude Code ─ 最新動向と企業導入
takaakikakei
1
260
「全員プロダクトマネージャー」を実現する、Cursorによる仕様検討の自動運転
applism118
22
12k
Agile PBL at New Grads Trainings
kawaguti
PRO
1
440
250905 大吉祥寺.pm 2025 前夜祭 「プログラミングに出会って20年、『今』が1番楽しい」
msykd
PRO
1
980
バイブスに「型」を!Kent Beckに学ぶ、AI時代のテスト駆動開発
amixedcolor
2
580
新アイテムをどう使っていくか?みんなであーだこーだ言ってみよう / 20250911-rpi-jam-tokyo
akkiesoft
0
310
Featured
See All Featured
The Invisible Side of Design
smashingmag
301
51k
No one is an island. Learnings from fostering a developers community.
thoeni
21
3.4k
The Straight Up "How To Draw Better" Workshop
denniskardys
236
140k
Side Projects
sachag
455
43k
The Myth of the Modular Monolith - Day 2 Keynote - Rails World 2024
eileencodes
26
3k
jQuery: Nuts, Bolts and Bling
dougneiner
64
7.9k
Writing Fast Ruby
sferik
628
62k
Bash Introduction
62gerente
615
210k
Learning to Love Humans: Emotional Interface Design
aarron
273
40k
How to Create Impact in a Changing Tech Landscape [PerfNow 2023]
tammyeverts
53
2.9k
Mobile First: as difficult as doing things right
swwweet
224
9.9k
The Cult of Friendly URLs
andyhume
79
6.6k
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)