2007-08-01ãã1ã¶æéã®è¨äºä¸è¦§
shiro ããã«é ããã½ã¼ã¹ã³ã¼ããç§ãªãã«ã³ã¡ã³ã ;; ã¾ããc ã«ã¯ hop ãå®è¡ããåã®ç¶ç¶ãå ¥ãã¾ãã (define c (begin (print "hip") (let ((x (call/cc (lambda (y) y)))) (print "hop") x))) hip hop c gosh> c ;; ãããããã¡ããã¨å ¥ã£ã¦ããããâ¦
ç¶ç¶ã¨ã¯ä½ããåãã£ãã®ã§ãç¶ç¶æ¸¡ãå½¢å¼ã¨ã¯ä½ãã«ã¤ãã¦èª¿ã¹ã¦ã¿ããhttp://karetta.jp/book-node/kahua-seminar2/000511 ãèªãã¨ãCPS ã« call/cc ã¯å¿ è¦ç¡ãäºãåãã£ãããã£ãããã¨è¨ãäºã§ããã®ãã¼ã¸ã®ä¾ã Haskell 㨠Squeak ã«åçµããªããâ¦
ç§ã®è¦æãªåèªã§ããç¶ç¶ã¨ããã«ã¤ãã¦èª¿ã¹ã¦ã¿ããå®ç¾©: ãããã°ã©ãã³ã°è¨èª SCHEMEãã®ãã¾ãã® R5RS 6.4. å¶å¾¡æ©è½ããæç² procedure: (call-with-current-continuation proc) proc ã«ã¯1å¼æ°ãåãåãããã·ã¼ã¸ã£ãæå®ãããããã·ã¼ã¸ã£ call-wâ¦
http://d.hatena.ne.jp/propella/20070825/p1 ã®ç¶ãã§ãããã£ã³ãã§åãã¦è¦ãããã¼ã¿ããã¼è¨èªã®ãã¬ã¼ã³ãèå¿ãªã¹ã¿ãã¯è¨èªã®èª¬æãä¸æãè¡ããªãã¦å¤±æã ï¼ã¨ããã£ã¦ãããã©ãã¸ã§ã³ã»ãããã¼ãããé¢ç½ãã£ãã¨è¨ã£ã¦ãããã®ã§åãå¬ããã£ãâ¦
ä»æ¥ã¯ãã£ã³ãç²ãã§ä¸æ¥ã¼ã¼ã£ã¨ãã¦ãããä½ãããæ°ãèµ·ããªãã®ã§ãã¨ãããããã ããã«è¦ãããã¦ãã skirball ã¨ããåç©é¤¨ã«ãããé¢ç½å½«å»ã§ãè¦ã«è¡ã£ããé¢ç½å½«å»ã¯å度åãããã¦ã¤ãã¤ãã ã£ãããä½µè¨ã®ã¦ãã¤ç¾è¡é¤¨(ã¨ãããæ°ä¿åç©é¤¨ã®ãâ¦
http://d.hatena.ne.jp/propella/20070806/p1 ã®ç¶ãããã¬ã¼ã³çã§ã¯ä»ããããã°ã©ã ã®ã·ã«ã¨ããã«ã¤ãã¦è©±ãã¾ããããã¯ä½ã§ããããå½¢ã®ããåããå½±ã¨åããã«ããå½±ãããã¾ãããããªããæ¬ä½ããå½±ã®æ¹ãåããããããããã°ã©ã ã«ãå½±ãããã¾ãâ¦
http://d.hatena.ne.jp/propella/20070808/p2 ã«æ¸ããã¢ã¤ãã¢ã®ç¶ãã§ããéæ£æ ¼ãªã¹ã¿ãã¯è¨èªã¨ããã®ã¯åååè«ã§ããããã¼ã¿ããã¼è¨è¿°è¨èªã¨ãã¦ã®ã¹ã¿ãã¯è¨èªãæ³å®ããã¨åè«ããç¡ããªã£ã¦ãã¾ããããã¼ã¿ããã¼è¨è¿°è¨èªã¨ããã®ã¯ã©ãããæå³â¦
(ä¸ã«æ¸ãã¦ãããã¨ã¯åãªã®ã§æ°ãä»ãã¦ãã ãããåãã£ããæ¸ãç´ãã¾ã)http://d.hatena.ne.jp/propella/20070813/p1 ã§ããã«ãèªç¶å¤æã«ã¤ãã¦åãã£ããããªäºãæ¸ãã¦ãã¾ã£ããã©ããã¨ã§åè«ã®åºç¤ã®èª¬æãèªãã§ããã£ã±ãåããã¾ããã§ãããâ¦
ããã«ã¡ã¯ãããµã³ã¼ã«ã¹ã®ã¦ã¨ã¹ãã¦ããã«ä½ã¿å§ãã¦äºã¶æããã¡ã¾ãããæ¯æ¥è³å ã§ã¯è²ã ãªäºãç¹°ãåºãããã¦ãããã ãã©åç®ã§ã¿ãã¨ãã£ã¨æ» è¶è¦è¶å³æ°ãªãæ®ããããã¦ããã¨æãã¾ããåºæ¬çã«ã¯ãªãã£ã¹ã¨ã¢ãã¼ãã®å¾å¾©ã§ãæçãæåã®é ã ãâ¦
æ¬å½ã«ã©ãã§ãè¯ã話ã ãããã£ããããã¬ã¼ã¹ãåºæ¥ãã®ã§ã³ãããJoy ã®ããã§ãã§ã« Joy ã§ç¡ããªãã¤ã¤ããèªä½è¨èªã®æå³ããªã¼ã S å¼ã®ãããªè¨æ³ã§åºåãã¦ããæ§åãy:= ã¯ã»ãã¿ã¼ã:y ã¯ã²ãã¿ã¼ã§ãã®é¨å㧠Smalltalk ã¨éä¿¡ãã¾ããããªã¼ã®â¦
import Control.Arrow -- æ®éã« functionExp = 3 + 4 -- do è¨æ³ã¨ IO ã¢ããã使ããããã¨åãå¤æ°åã使ã£ã¦ã¿ãã monadExp1 = do x <- return 3 y <- return 4 x <- return (x + y) print x -- æ®éã®ã¢ããè¨æ³ãJoy è¨æ³ (3 4 +) ã«ä¼¼ã¦ããï¼ monadâ¦
ãã¤ããªããããã£ã¨ã¡ã¢ããä»æ¥ãã¹ã¿ãã¯è¨èªããããªã¼ã«å¤æããæ¹æ³ã«ã¤ãã¦èãã¦ãããæè¿ã¯æµè¾ºããæ°ã«å ¥ãã§ã30 åã¯ã©ã¼ã¿ã¼äºæãé§è»å ´ã®ãã·ã³ã«å ¥ãã¦ããã¯ãµç¬ãè¨ãè¨ããªããæµ·ã®è¦ããå ¬åãè¡ã£ããæ¥ããããããã¾ãã«ãèãããâ¦
ããã¼ï¼ ä»ã¾ã§èãã¦ããå ¨ã¦ã®åé¡ããã£ã¤ããï¼ æããããï¼ ã¬ãåã³ã«ãªããªãããã«ãã£ããèããªãã¨ãããªããã©ã è²ã é¢ä¿ãªããã¨ã«æãåºãã¦ããããã«è¦ãã¦ã ä¸ã¤ã®åé¡ã®è²ã ãªå´é¢ã ã£ãï¼ã¨ããããã¡ã¢ããè¨èªã²ã¼ã ãããã£ã¦ããâ¦
ã¢ã¤ãã¢ã¨ããã®ã¯æ§æ³ã®æ®µéã§ä½ãè¨ã£ã¦ããæ®éè¿ã£ã¦æ¥ãã®ã¯å¦å®çãªæè¦ã°ããã§ãããç¨åº¦å½¢ãè¦ããã¾ã§åãã£ã¦ããã人ã¯ããªããç¹ã«ç§ã®ãããªå°å¿è ã¯ããã§ããæ°ã失ãäºãå¤ãã®ã§æ¬å½ã®äºã¯é»ã£ã¦ãäºãå¤ãã®ã ã諸è¬ã®äºæ ã§å½¢ãå¤ãã¦â¦
ã¹ã¿ãã¯è¨èªã®ä¸ã«æãããªããã£ã㪠Arrow ãä½ããªãã ãããã¨èãã¦ãã¦éæ£æ ¼ãªã¹ã¿ãã¯è¨èªãè¯ãã®ã§ã¯ã¨æãã¤ããããã¨ãã° Haskell ãªããã ã¨ãå¼æ°ã¯å¿ è¦ã«ãªãã¾ã§å®è¡ãããªãã®ã§é 延è©ä¾¡ã表ç¾ããçºã®ç¹å¥ãªè¨æ³ãç¡ããä¾ãã° Joy ã ã¨â¦
import Control.Arrow newtype SF a b = SF {runSF ::[a]->[b]} instance Arrow SF where arr f = SF (map f) SF f >>> SF g = SF (f >>> g) first (SF f) = SF (unzip >>> first f >>> uncurry zip) instance ArrowChoice SF where left (SF f) = SF(\xs ->â¦
import Control.Arrow newtype SF a b = SF {runSF ::[a]->[b]} instance Arrow SF where arr f = SF (map f) SF f >>> SF g = SF (f >>> g) first (SF f) = SF (unzip >>> first f >>> uncurry zip) -- ã§ã¯ããããã話ã®åã«ãArrow ã®å©ç¹ã強調ããä¾ãâ¦
http://d.hatena.ne.jp/propella/20070807/p1 1:åºæ¬ http://d.hatena.ne.jp/propella/20070807/p2 2:並置 http://d.hatena.ne.jp/propella/20070808/p1 3:é¸æ -- ãªããç¥ãããã¡ã« Arrow æµè¡ã£ã¦ããããªã®ã§è©¦ãã¦ã¿ãã -- http://www.cs.chalmers.seâ¦
ãã¨ãã¨ãã®æ¥è¨ã¯èªåç¨ã®ã¡ã¢ã§ã決ãã¦äººã«èªã¾ããããã°ãªã®ã§ã¯ç¡ãã¦ãã°ããã¾ã§ã¯å¿åãå®ã£ã¦ãç¨ã§ããã©ãç¹ã«ä»æ¥ã®ã¯ä»ã®äººã«ã¯å ¨ãæå³ãæããªãã®ã§èªåç¨ã¡ã¢ã¨ããããæ¸ãã¾ããã ããé¢ç½ãç¡ããªãã¦è¨ããªãã§ãSqueakFest ã§æããâ¦
ä»å¹´ãå¤ã®æä¾ SqueakFest 2007 ãã·ã«ã´ã«ã¦éå¬ããã¾ãããããã¯æè¡çãªã«ã³ãã¡ã¬ã³ã¹ã¨ããããããæ室ã§ã®ææ¥ã§ã®å®è·µã«ã¤ãã¦è°è«ãããããªããå®éçãªä¼ã§ããä¸çä¸ã®å çæ¹ãéã¾ã£ã¦ã¹ã¯ã¤ã¼ã¯ãã©ããã風ã«ä½¿ã£ã¦ããã話ãåãã¨ããç©â¦