[[ネタ記録庫/不動点コンビネータ]]
#contents
*不動点コンビネータとは [#w1012c93]
''FIXME:''説明追加&リンク追加

*型なしλ計算 [#c484e485]
ラムダ式で書くと
 λf.(λx.f(xx))(λx.f(xx))
ただしこれでは(xx)に型が付かない。

*Haskell [#kdeed056]
 -- 不動点演算子 Y
 y :: a -> a -> a
 y f = f (y f)
 
 -- yの使用例 再帰関数 fact を 高階関数 fac の不動点として定義する
 fact = 
   let fac f = ?x -> 
       if x == 0 
         then 1 
         else x * f (x-1) 
   in y fac

*Ocaml [#wad972ea]
 -- 不動点演算子
 # let rec y f = f (lazy (y f))
  val y : ('a lazy_t -> 'a) -> 'a = <fun>
 -- yの使用例
 # let fac f = function
     0 -> 1
   | x -> x * (Lazy.force f) (x - 1)
 # let fact = y fac
 -- こっちが普通かな...?
 # let y f x = f (y f) x

*解説ページ [#l36ce47d]
**英語 [#re660aee]
- [[Many faces of the fixed-point combinator:http://okmij.org/ftp/Computation/fixed-point-combinators.html]] Schemeの例,continuation等
- [[Haskell Wiki / FixedPointCombinator:http://www.haskell.org/hawiki/FixedPointCombinator]]
- Olegさん http://pobox.com/~oleg/ftp/ML/fixpoints.ml
- Olegさん http://pobox.com/~oleg/ftp/Computation/fixed-point-combinators.html#Self-
**日本語 [#t23af16b]
- [[名大の誰かの解説:http://www.ice.nuie.nagoya-u.ac.jp/~h003149b/lang/fix.html]]この人はどこに行ったんだろう
- [[住井先生の解説:http://d.hatena.ne.jp/sumii/20051203/1133575324]] [[続き:http://d.hatena.ne.jp/sumii/20051205/1133775091]]
トップ   編集 差分 バックアップ 添付 複製 名前変更 リロード   新規 一覧 単語検索 最終更新   ヘルプ   最終更新のRSS