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
98
不動点コンビネータって何ぞ #TechLunch
2012/02/15(水) @ Livesense TechLunch
発表者:春日 太志
Livesense Inc.
PRO
April 23, 2014
Tweet
Share
More Decks by Livesense Inc.
See All by Livesense Inc.
株式会社リブセンス 会社説明資料(報道関係者様向け)
livesense
PRO
0
1.1k
データ基盤の負債解消のためのリプレイス
livesense
PRO
0
260
26新卒_総合職採用_会社説明資料
livesense
PRO
0
4.6k
株式会社リブセンス会社紹介資料 / Invent the next common.
livesense
PRO
1
13k
26新卒_Webエンジニア職採用_会社説明資料
livesense
PRO
1
8.2k
中途セールス職_会社説明資料
livesense
PRO
0
200
EM候補者向け転職会議説明資料
livesense
PRO
0
87
コロナで失われたノベルティ作成ノウハウを復活させた話
livesense
PRO
0
210
転職会議でGPT-3を活用した企業口コミ要約機能をリリースした話
livesense
PRO
0
1.3k
Other Decks in Technology
See All in Technology
OCI Success Journey OCIの何が評価されてる?疑問に答える事例セミナー(2025年2月実施)
oracle4engineer
PRO
2
170
AWSを活用したIoTにおけるセキュリティ対策のご紹介
kwskyk
0
410
アジャイルな開発チームでテスト戦略の話は誰がする? / Who Talks About Test Strategy?
ak1210
1
660
LINEギフトにおけるバックエンド開発
lycorptech_jp
PRO
0
360
[OpsJAWS Meetup33 AIOps] Amazon Bedrockガードレールで守る安全なAI運用
akiratameto
1
110
自分だけの仮想クラスタを高速かつ効率的に作る kubefork
donkomura
0
110
JAWS DAYS 2025 アーキテクチャ道場 事前説明会 / JAWS DAYS 2025 briefing document
naospon
0
2.5k
AIエージェント時代のエンジニアになろう #jawsug #jawsdays2025 / 20250301 Agentic AI Engineering
yoshidashingo
8
3.9k
EMConf JP 2025 懇親会LT / EMConf JP 2025 social gathering
sugamasao
2
200
サイト信頼性エンジニアリングとAmazon Web Services / SRE and AWS
ymotongpoo
7
1.7k
Share my, our lessons from the road to re:Invent
naospon
0
150
AWS Well-Architected Frameworkで学ぶAmazon ECSのセキュリティ対策
umekou
2
150
Featured
See All Featured
For a Future-Friendly Web
brad_frost
176
9.6k
Chrome DevTools: State of the Union 2024 - Debugging React & Beyond
addyosmani
4
380
Templates, Plugins, & Blocks: Oh My! Creating the theme that thinks of everything
marktimemedia
30
2.2k
Evolution of real-time – Irina Nazarova, EuRuKo, 2024
irinanazarova
6
570
Navigating Team Friction
lara
183
15k
The Art of Delivering Value - GDevCon NA Keynote
reverentgeek
10
1.3k
The Illustrated Children's Guide to Kubernetes
chrisshort
48
49k
Docker and Python
trallard
44
3.3k
VelocityConf: Rendering Performance Case Studies
addyosmani
328
24k
Making Projects Easy
brettharned
116
6k
Bash Introduction
62gerente
611
210k
Distributed Sagas: A Protocol for Coordinating Microservices
caitiem20
330
21k
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)