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
Getting to Know Your Legacy (System) with AI-Driven Software Archeology (WeAreDevelopers World Congress 2025)
feststelltaste
1
130
KiCadでPad on Viaの基板作ってみた
iotengineer22
0
300
2025 AWS Jr. Championが振り返るAWS Summit
kazukiadachi
0
110
生成AI活用の組織格差を解消する 〜ビジネス職のCursor導入が開発効率に与えた好循環〜 / Closing the Organizational Gap in AI Adoption
upamune
7
5.2k
オーティファイ会社紹介資料 / Autify Company Deck
autifyhq
10
130k
ビギナーであり続ける/beginning
ikuodanaka
3
750
Flutter向けPDFビューア、pdfrxのpdfium WASM対応について
espresso3389
0
130
開発生産性を組織全体の「生産性」へ! 部門間連携の壁を越える実践的ステップ
sudo5in5k
2
7k
Claude Code に プロジェクト管理やらせたみた
unson
6
3.9k
Sansanのデータプロダクトマネジメントのアプローチ
sansantech
PRO
0
150
Oracle Database@Google Cloud:サービス概要のご紹介
oracle4engineer
PRO
0
110
赤煉瓦倉庫勉強会「Databricksを選んだ理由と、絶賛真っ只中のデータ基盤移行体験記」
ivry_presentationmaterials
2
360
Featured
See All Featured
Agile that works and the tools we love
rasmusluckow
329
21k
How to Create Impact in a Changing Tech Landscape [PerfNow 2023]
tammyeverts
53
2.9k
The Language of Interfaces
destraynor
158
25k
jQuery: Nuts, Bolts and Bling
dougneiner
63
7.8k
How to Think Like a Performance Engineer
csswizardry
25
1.7k
Into the Great Unknown - MozCon
thekraken
40
1.9k
Optimizing for Happiness
mojombo
379
70k
XXLCSS - How to scale CSS and keep your sanity
sugarenia
248
1.3M
[RailsConf 2023] Rails as a piece of cake
palkan
55
5.7k
ReactJS: Keep Simple. Everything can be a component!
pedronauck
667
120k
The Myth of the Modular Monolith - Day 2 Keynote - Rails World 2024
eileencodes
26
2.9k
GraphQLの誤解/rethinking-graphql
sonatard
71
11k
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)