ååããä¸å¹´ä»¥ä¸ãçµéãã¦ãããã©ãæè¿lambda_driver.gemã«æ©è½ã追å ããã®ã§ããã®ãã¨ã«ã¤ãã¦æ¸ããã¨æãã Rubyã§ãã¢ãâ¦â¦ã£ã½ãé¢æ°åæãå®è£ ãã話ã ã Rubyã§é¢æ°åæã¨ããããã®ã§ lambda_driver.gem ã¨ããã®ãä½ã£ã - ( êªâêª) ããããæ¥è¨ é¢æ°åæ é¢æ°åæã«ã¤ãã¦ã¯ä»¥åã«æ¸ããã®ã§ããã¡ããè¦ã¦æ¬²ããã ãé¢æ°åRubyãã¨ããç (2) - é¢æ°åæ Proc#compose - ( êªâêª) ããããæ¥è¨ ããããããã¦ããã¨ãé¢æ°åæã¨ã¯ã é¢æ°gã¨é¢æ°fãããg(f(x))ã¨ããé¢æ°hãæ°ãã«ä½ãåºããã¨ã ã (g â f)(x) = g(f(x)) é¢æ°gã¨é¢æ°fã®åæé¢æ°g â fã«å¼æ°xã渡ããçµæã¯ãé¢æ°gã«f(x)ã®çµæã渡ãããã®ã¨çãããã¤ã¾ãããã®ãããªæä½ã§ããã f = lambda{|x| x + 1
LambdaDriver by yuroyoro Rubyã§ãProcãlambdaã§é¢æ°åæã§ããããã«ãããã£ãã®ã§ãlambda_driver.gemã¨ããã®ãä½ã£ãã å 容çã«ã¯ãã®è¾ºã§æ¸ããã¤ããgemã«ããæãã ãé¢æ°åRubyãã¨ããç (2) - é¢æ°åæ Proc#compose - ( êªâêª) ããããæ¥è¨ ãé¢æ°åRubyãã¨ããç (3) - ã«ãªã¼å(Proc#curry, Proc#flip) - ( êªâêª) ããããæ¥è¨ ãããªé¢¨ã«ãã«ãã³ããã³ã¼ããæ¸ããã require 'lambda_driver' # [:foo, :bar, :baz].map{|s| s.to_s }.map{|s| s.upcase } # [:foo, :bar, :baz].map(&:to_s).map(&:upcase) [:foo, :bar, :baz].map(
å¤ãè¯ãå°å¦æ ¡ã®æ代ããã®è¡ã«ã¯å°æããããããã®ã ã£ãã éè¡ç㪠x ããå ç®ãããã®ã«çããã¾ã¾ã§ããäºã«ã ã©ãããããããããã°ã©ãã³ã°ãå§ããã¨ãããã«æ§ããªããªãã ããããããããã¯é大ãªäºæãããªãããããã°ã©ãã³ã°ã¨ã¯ç¾å®ã®ãã¸ãã¹è¡çºãªãã ããã æ°å¦çãªç´ç²ãã«ã¤ãã¦ããæ¢ããªãã¦å¿ è¦ç¡ã (ãã®è°è«ãªãã大å¦ã«ããçã£ãé«é¢ééã©ãã«ããã¦ããã°ãã)ãã¨æã£ã¦ããã ããã©ãããã ç¥ããªãã£ãã ãã§ãæã ãééã£ã¦ãã¦é«ã代åãæ¯æã£ã¦ããã®ã¯ æããã§ããã Wikipedia ã«ããã°ããé¢æ°åããã°ã©ãã³ã°(functional programming, FP)ã¨ã¯ã è¨ç®ãæ°å¦çãªé¢æ°ã®è©ä¾¡ã¨ã¿ãªãã ç¶æ ãå¯å¤ãã¼ã¿ãé¿ããããã°ã©ãã³ã°ãã©ãã¤ã ãã§ããã è¨ãæããã¨ãé¢æ°åããã°ã©ãã³ã°ã¯ã å¯ä½ç¨ãç¡ãå¤æ°ã®å¤ãå¤åãããªãã³ã¼ããæ¨å¥¨ããã
ããã°ãä¸è¨ã«ç§»è»¢ãã¾ããããã¶ã¤ã³å¤æ´ã«ãã移転å ã§ã¯è¨äºãä¸å±¤èªã¿ããããªã£ã¦ãã¾ãã®ã§ããããããã°ç§»åããé¡ãè´ãã¾ãã Rubyã使ã£ã¦ããªãé¢æ°ããã°ã©ãã³ã°ã¯éè¦ããã解èªãããï¼ : melborne.github.com - ãWhy Functional Programming Matters:ãªãé¢æ°ããã°ã©ãã³ã°ã¯éè¦ãã(åèè ï¼John Huges é¦è¨³ï¼å±±ä¸ä¼¸å¤«)ã¨ããè«æãããã¾ã ãªãé¢æ°ããã°ã©ãã³ã°ã¯éè¦ã ããã¯Mirandaã¨ããé¢æ°åè¨èªã使ã£ã¦ ããã°ã©ãã«ã¨ã£ã¦ é¢æ°ããã°ã©ãã³ã°ãããã«éè¦ã§ããããè«è¨¼ãããã®ã§ã ãããæ¸ããã¦ããã®å¹´æ°*1ã¨è¢«ãã¯ãæ°ãè¦ã㰠極ãã¦æçã§must_readã§ãããã¨ã¯æããã§ãããã èªåã«ã¨ã£ã¦ã¯é«åº¦ãªå 容ã§èªã¿è§£ãã®ã«ããªãè¦å´ãã¦ãã¾ã ãªã¹ãã使ã£ãé¢æ°ã®è²¼ãåã(3.ã®åå)ã¾ã§ã«ã¤ãã¦
John Hughes, Institutionen för Datavetenskap, Chalmers Tekniska Högskola, 41296 Göteborg, SWEDEN. [email protected] ãã®æ¥æ¬èªè¨³ã¯åèè ã®æ¿è«¾ãå¾ã¦å±±ä¸ãããã«å ¬éãããã®ã§ãã ãã®è¨³æã«ã¤ãã¦ã®ã御ææãªã©ã¯å±±ä¸ä¼¸å¤«(nobsun .at. sampou.org)ã¾ã§ãããã ãããã¾ãã 翻訳æçµæ´æ°æ¥ : 2011-09-17 åæ "Why Functional Programming Matters" æ¥æ¬èªè¨³PostScript ãã®è«æã¯1984年以æ¥ä½å¹´ãã®ããã Chalmers大å¦ã®ã¡ã¢ã¨ãã¦å覧ãããã 1989å¹´ã¨1990å¹´ã«å¹¾åãæ¹è¨ãããã®ã[Hug89]㨠[Hug90]ã§ããããã®çã¯ãã¨ã®Chalmer大å¦ã®ã¡ã¢ ã®nroffå稿ããã¨ã«
ãªãªã¼ã¹ãé害æ å ±ãªã©ã®ãµã¼ãã¹ã®ãç¥ãã
ææ°ã®äººæ°ã¨ã³ããªã¼ã®é ä¿¡
å¦çãå®è¡ä¸ã§ã
j次ã®ããã¯ãã¼ã¯
kåã®ããã¯ãã¼ã¯
lãã¨ã§èªã
eã³ã¡ã³ãä¸è¦§ãéã
oãã¼ã¸ãéã
{{#tags}}- {{label}}
{{/tags}}