çµå±Chatonä¸ã®Gaucheã®ãã£ããã«ã¼ã ã§è³ªåããããshiroããã«callccã®ãªããã©ãããã©ã¼ã ä¸ã§æ«å°¾å帰æé©åããæ¹æ³ãæãã¦é ããã
çµå±Chatonä¸ã®Gaucheã®ãã£ããã«ã¼ã ã§è³ªåããããshiroããã«callccã®ãªããã©ãããã©ã¼ã ä¸ã§æ«å°¾å帰æé©åããæ¹æ³ãæãã¦é ããã
éè¦ï¼ ãã®ãã¼ã¸ã¯ããã¯ãå¤ããªã£ã¦ãã¾ãã Webãµã¼ã㯠nginx [engine x] ããããããã¾ããApache HTTP Server ã使ãå ´åã§ãã£ã¦ããRuby ã®çµã¿è¾¼ã¿ã¯ Passenger ã¢ããªã±ã£ã·ã§ã³ãµã¼ããããã§ãããã mod_rubyã¯ãApache HTTPãµã¼ãã«Rubyã¤ã³ã¿ããªã¿ãçµã¿è¾¼ãã¢ã¸ã¥ã¼ã«ã é常ã®CGIã¹ã¯ãªããã§ã¯ãå®è¡ãããã³ã«Rubyã¤ã³ã¿ããªã¿ãèµ·åããã®ã§é ããmod_rubyã使ãã°ãã®æéãç縮ã§ããã ä¸æºå mod_rubyãã¤ã³ã¹ãã¼ã«ããããã«ã¯ãApache HTTPãµã¼ãã«åçã¢ã¸ã¥ã¼ã«ãçµã¿è¾¼ããããã«ãã¦ãããªãã¨ãããªããä¸è¨ãåç §ã Apache2/2.2 HTTPãµã¼ãã®ã¤ã³ã¹ãã¼ã« mod_rubyã®ã¤ã³ã¹ãã¼ã« mod_rubyã®ã½ã¼ã¹ãã¡ã¤ã«ãå ¥æãã解åããã modruby.net
ä»æ cgi ã¯ç¡ãæãã ãã©ï¼ã¡ãã£ã¨ããã¹ã¯ãªãããåããããã¨ãã¯ã¾ã ã¾ã 便å©ã§ï¼ä½ã§ãæ¸ããã£ã¦ã®ã¯å¤§ããï¼ã¡ãã£ã¨ããå®é¨ç¨éã§çµæ§ä½¿ãã®ã§è¨å®ããï¼ã¨ã¯ãããã®ã®ï¼ãã¯ãä»æã§ãªãæããªã®ã§ Debian ã® apache ã§ã¯ æ¨æºã§ã¯è¨å®ããã¦ããªãï¼ãªã®ã§ï¼æåã§ããè¨å®ãããï¼httpd.conf ã apache2.conf ã«ç´æ¥è¨è¿°ãã¦ãåé¡ã¯ç¡ãããã©ï¼æ¨æºã§æ©è½ãã¨ã«ãã¡ã¤ã«ãåãããã¦ããã®ã§ï¼ãã®æµåã«å¾ã£ã¦ãããªæãã«ããï¼ % cat /etc/apache2/conf.d/cgi <IfModule mime_module> TypesConfig /etc/mime.types AddHandler cgi-script .cgi .rb </IfModule> .cgi 㨠.rb ãã¡ã¤ã«ã§ cgi ãåä½ããããã«ãªã£ã¦è¯ãæããªã£ãï¼ã§ãï¼
â Perlåºç¤ææ³æéãã¹ã¿ã¼ãã ããããã®ã¾ã¾ãRubyã«ç½®ãæãã¦ã¿ã¾ããã ä»ã®è¨èªãããç¨åº¦ç¥ã£ã¦ãã人ã¯ãããèªãã°Rubyã®åºç¤ããã¹ã¿ã¼ãã¦Rubyãæ¸ããã¨ãã§ããããã«ãªãâ¦ããç¥ãã¾ãããç¡ä¿è¨¼ã§ãã åèï¼ ãªãã¸ã§ã¯ãæåã¹ã¯ãªããè¨èª Ruby ãªãã¡ã¬ã³ã¹ããã¥ã¢ã« (1.9.2) ãªãã¸ã§ã¯ãæåã¹ã¯ãªããè¨èª Ruby ãªãã¡ã¬ã³ã¹ããã¥ã¢ã« (1.8.7) â 1. åºç¤ ã¤ã³ã¿ã©ã¯ãã£ãRuby (irb) irbã使ãã¨ãRubyã®ããã°ã©ã ãç°¡åã«ç·´ç¿ãããã¨ãã§ãã¾ãã /Users/yhara $ irb irb(main):001:0> puts "hello" hello => nil irb(main):002:0> 1 + 1 => 2 以ä¸ã®èª¬æã¯ãirbãèµ·åãã¦ãèªåã§è©¦ããªããèªãã¨ç¿å¾ãæ©ãã¨æãã¾ãã 表示 (print,
å帰çãªé¢æ°ãä½ãã¨ãã«é¢æ°ã«ååãã¤ããã«å®ç¾©ããã«ã¯ã©ããããããã®ãã¨ããã®ããY Combinatorã®ä¸å¿çãªè©±é¡ã§ãã ã¾ãã¯ãå帰ã®å®çªãéä¹ãè¨ç®ããé¢æ°ã«ç»å ´é¡ãã¾ãããã fact = lambda{|n| if n < 2 1 else n * fact[n - 1] end } puts fact[10] ããããfactã¨ããååãåãé¤ããã¨ããããã§ããã æçµç®æ¨ã¯ã以ä¸ã®ããã«ãã¦éä¹ãè¨ç®ããé¢æ°ãå®ç¾©ãããã¨ãã§ããããã«ãªããã¨ã§ãã fact = y[lambda{|h| lambda{|n| if n < 2 1 else n * h[n - 1] end } ] ) puts fact[10] ããã§åºã¦ããyããY Combinatorã¨å¼ã°ãããã®ã§ãã è¦ãããã®çºã«ãfactã¨ããååãã¤ãã¾ããããé¢æ°ãå®ç¾©ããã¨ããã§ã¯fact
ã©ã³ãã³ã°
ã©ã³ãã³ã°
ã©ã³ãã³ã°
ãªãªã¼ã¹ãé害æ å ±ãªã©ã®ãµã¼ãã¹ã®ãç¥ãã
ææ°ã®äººæ°ã¨ã³ããªã¼ã®é ä¿¡
å¦çãå®è¡ä¸ã§ã
j次ã®ããã¯ãã¼ã¯
kåã®ããã¯ãã¼ã¯
lãã¨ã§èªã
eã³ã¡ã³ãä¸è¦§ãéã
oãã¼ã¸ãéã
{{#tags}}- {{label}}
{{/tags}}