Yã³ã³ããã¼ã¿ï¼ä¸åç¹æ¼ç®åï¼ã®å°åºæ³
MinCamlのページãããªã³ã¯ããã¦ããã®ã«ããã°ã©ãã³ã°è¨èªã®è©±é¡ãï¼ãã¾ãï¼ãªãã®ã¯ã¤ãã¤ããªã®ã§ãçªçºããã»ãã¥ã¼ããªã¢ã«éå§ã
ç´ç²ãªÎ»è¨ç®ã§å帰é¢æ°ã表ãã®ã«ä½¿ã
λf.(λg.f(g g)) (λg.f(g g))
ã¨ããλå¼ãããã¾ãï¼ããã ã¨åããã£ããcall-by-valueãªè¨èªã¯é§ç®ã§ãããã¨ããããåãªãï¼call-by-nameã¨ãã¦ï¼ãã©ããããããªå¼ãåºã¦ããã®ããæ¥ããããªãããã¤ããã®éã¾ã§å°ãæ¹ãç¥ããªãã£ãã®ã§ããããµã¨ãããã¨ããæ°ã¥ããã®ã§æ¸ãã¦ããã¾ãã
let rec g = F(g) in g
ã¨ããå帰é¢æ°ããã£ãã¨ãã¾ãããã ããF(g)ã¨ããã®ã¯gãå«ã¾ããä½ããã®å¼ã§ããããã
let g = (gãå«ã¾ãªãå¼) in g
ã®ããã«ãgã®å®ç¾©ã®å³è¾ºã«gèªèº«ãåºç¾ããªãå½¢ã§æ¸ãããããã§ãããã¡ãããç´ æ´ã«
let g = F(g) in g
ãªã©ã¨ãã¦ããF(g)ã®ä¸ã«å«ã¾ããgãå®ç¾©ãããªãã®ã§é§ç®ã§ããããã§ããã¾ã å®ç¾©ããã¦ããªããã©ãããããå®ç¾©ãããèªåèªèº«gããå¾ããåãåããããã«
let g' = λg.F(g g) in (g' g')
ã¨ãã¾ããg'ã¨ããã®ãããgãåãåããããã使ã£ã¦gã®å®ç¾©ãè¿ãããããªé¢æ°ã§ããããã§g'ã®å®ç¾©ãã¤ã³ã©ã¤ã³å±éããã°
(λg.F(g g)) (λg.F(g g))
ã¨ãªãã¾ããããã使ãã¨ãã¯ããã®å帰é¢æ°
let rec g = F(g) in g
ã¯
(λg.F(g g)) (λg.F(g g))
ã¨è¡¨ãã¾ãã以ä¸ã®è°è«ã¯ä»»æã®Fã«ã¤ãã¦æç«ããã®ã§ãFãλæ½è±¡ãã¦
λf.(λg.f(g g)) (λg.f(g g))
ã¨ããλå¼ãå°åºã§ãã¾ãã
â¦ã£ã¦ãã¾ã ãããã«ããã§ãããç¹ã«Î»g.F(g g)ã®ããããâ¦