æ°åã¤ã³ãã«ã¨ã³ã¶
æ°åã¤ã³ãã«ã¨ã³ã¶ã«ããã£ã¦ãã¾ã£ããããªã®ã§
診æãããçµç·¯ãªã©ãæ¸ãã¾ã
æ¥ææ¥æ£åãããããããããªããåã ããçãç¶æ
æææ¥åå0æããããã ã足ãçèçã¿ããã«çããªã
æææ¥åå4æ30åãããã ç®ç©ãããã®ã§ç±ã測ã£ãã38度ã ã£ã
æææ¥åå5æãããããã å°ç¨åä»ã«é£çµ¡ã
ãããããããããããããä»ç·æ¥ã§ç
é¢ã«è¡ã£ã¦æ¤æ»ãã¦ã
ãããããããããããããã¤ã³ãã«ã¨ã³ã¶ãã©ããåãããªã
ãããããããããããããä»®ã«é½æ§ã ã£ãã¨ãã¦ãè¬ã1æ¥å
ãããããããããããããããåºãªãã¨è¨ããã
ãããããããããããããâä½å温åãã¦æç
é¢ã«è¡ãããã«ãã
æææ¥9æãããããããã ç
é¢ã«è¡ããªããã°ãªããªãã
ãããããããããããããã©ããã¦ãä½èª¿ãæªããã
ãããããããããããããç
é¢ã«è¡ãæéã延ã°ã
æææ¥11æããããããããç
é¢ã¸è¡ã
ç
é¢ã«è¡ã£ã¦ããå
çãããã¤ã³ãã«ã¨ã³ã¶ã ã¨æãããã¨ãããã¾ãã
å³ã®æãã¨ãç±ã®åºæ¹é¼»æ°´ãªã©ããããã®ã¾ãã¾ã¤ã³ãã«ã¨ã³ã¶ã®
çç¶ãã®ãã®ãããã§ã
æ¤æ»ããã¦ãçºç±ãã¦ããã®ãªã®ãª8æéã®ããæ¤æ»ããã¦ã
é½æ§ãåºãªããããããªãããã©æ¤æ»
æéçãªãã®?ã§æ¤æ»çµæã¯ã¤ã³ãã«ã¨ã³ã¶AåBåã¨ãã«åå¿ç¡ã
æ°åã¤ã³ãã«ã¨ã³ã¶ã®å ´åã¯ã¡ãã£ã¨å¾æ¥ã®ã¤ã³ãã«ã¨ã³ã¶ã¨ã¯
éã£ã¦ãäºãå¤ãããã§
ã¤ã³ãã«ã¨ã³ã¶ã®çç¶ãã®ãã®ãªã®ã«ä½åæ¤æ»ãã¦ãåºãªãã¦
æçµçã«è¡æ¶²æ¤æ»ããã¦åãã£ããããäºãããããã§ã
å
çã¯ã¤ã³ãã«ã¨ã³ã¶ã®æ¤æ»ããããæéãããã¦ä½¿ãäºãèããããã§ãã
ä»ç¾å¨ã¤ã³ãã«ã¨ã³ã¶ã®æ¤æ»ããããä¸è¶³ãã¦ãããã1人ã®æ£è
ã«
æ°åæ¤æ»ãããã使ãã®ãé£ããã¨ã®äºãã¾ãè¡æ¶²æ¤æ»ãããã¨ããã§
è¡æ¶²æ¤æ»ã®çµæãåºãã®ã¯æããæ²»çããå¾ã ã¨æãããäº
ãåãããå度ã®æ¤æ»ã¯ããªãæ¹åã«æ±ºãã¾ãã
ãã å
çã®æè¦ã§æããã«æ°åã¤ã³ãã«ã¨ã³ã¶ã¨ã®äºãªã®ã§
ã¿ããã«ãå¦æ¹ããã¦ä»ç¾å¨æç¨ãã¦ãã¾ã
æ¨æ¥ã¯ç±ã38度ã®ãããã§æ¨ç§»ãã¦ãã¾ãããã
ä»ã¯ç±ãä¸ãã£ã¦è½ã¡çãå§ãã¦ãã¾ã
ã ãã©ã¾ã å¦æ æãå³ã鼻水ã¯ã¾ã ã¾ã ç¶ãã¦ãã¾ã
ä»ã¯èª°ã«ãææãã¦ããªãäºãé¡ãã®ã¿ã§ã
ä»åº¦ã¯ä¸æ£ãªå¤ãå ¥åããæã«ãã£ãããããæ¢ããããã«ãã
æ¨æ¥schemeã§ãã£ãããããæ¸ããã®ã§ä»åº¦ã¯haskell!ã¨æã£ã¦ããã
ã¾ãåé¡ãåºããã¾ããã»ã»ã»
ãã®æ¡ä»¶ã ã¨(fib (- 1))ã¨ãfib(1.2)ã§æ¢ã¾ããªãã³ã¼ãã«ãªã
ã¨ãããã¨ã§ä¸æ£ãªå¤ãå
¥åããæã«ã¢ã©ã¼ããè¿ãã³ã¼ããæ¸ããï¼
ã¨ããäºã«ãªãæ¸ãã¦ã¿ã¾ãã
(define (fib n) (cond ((= n 0) 0) ((= n 1) 1) ((>= n 2)(+ (fib (- n 1)) (fib (- n 2)))) (else (display "å ¥åãä¸æ£ã§ã"))))
ããã¦ä¸æ£ãªå¤ãå ¥ãã¦å®è¡ãã¦ã¿ãã¨
gosh> (fib "hoge") *** ERROR: Number required, but got "hoge" Stack Trace: _______________________________________ gosh> (fib 7) 13
ã¢ã©ã¼ããåºã¦æ¥ãªã!!!!
ãªãã§ã¢ã©ã¼ããåºã¦æ¥ãªããåãããªãã£ãã®ã§ã¢ããã¤ã¹ãåãã¦
ã¨ããããR5RSã®æ¥æ¬èªã®PDFãDownloadãã¦number?ã§æ¤ç´¢ãã¦èªã¿ã¾ãã
ãªãã¨ãªãããåãããªãã£ããã©
ããã¢ã©ã¼ããåºãããã®ãªãæ¸ãããã£ããããã®ã³ã¼ããæ´ã«
true or falseã«åå²ããã¦falseã®å ´åã«ã¢ã©ã¼ãã
åºãããã«ãããããã¨ããäºã«æ°ä»ãã¾ãã
ãã¦ã³ã³ã¾ã§åãã£ããã©ã»ã»ã»ã£ã¦ãããï¼ï¼ï¼ï¼ï¼
gosh> (define (fib n) (cond ((= n 0) 0) ((= n 1) 1) ((>= n 2)(+ (fib (- n 1)) (fib (- n 2)))) (else (display "å ¥åãä¸æ£ã§ã")))) fib gosh> (fib 0.2) å ¥åãä¸æ£ã§ã#<undef> gosh> (fib "hoge") *** ERROR: Number required, but got "hoge" Stack Trace: _______________________________________
ç§çã«ã¯"hoge"ã¨ãæååãå
¥ãã¦ã"å
¥åãä¸æ£ã§ã"ã£ã¦
è¿ã£ã¦ããã¨æã£ã¦ãã
ã ãã©Number required, but got "hoge"ã®errorãã¿ãã¨
["hoge"ã¯ãã£ããã©æ°ãå
¥ãã¦]ã¨è¨ã£ã¦ããã®ã§
"å
¥åãä¸æ£ã§ã"ã£ã¦è¿ã£ã¦æ¥ãªãã¦ãããã®ããªï¼ï¼ï¼
æååãããªãã¦ä¸æ£ãªå¤ãå
¥ãããæ¢ã¾ã£ã¦ã¯ããã¨æããã ãã©ã»ã»ã»
ããããèªä¿¡ããªã。ï¼ï¾(。ï¾Ï\。)ï¾ï½¥ï½¡
æååã¨æ°åãªã®ã§ãªãã¸ã§ã¯ãã®åã¯éããã©
ä¸æ£ãªæ°åå
¥åã®å ´åãä¸æ£ãªæååãå
¥åã®å ´åãåãããã«
ã¢ã©ã¼ãããè¿ãã¦ããªãã¡ããã¡ãªã®ããªï¼
åãã¨ããããã³ãããããã¾ãã£ã¦ãã¾ããã»ã»ã»orz
schemeã§ãã£ãããã
ããæ¥å人ã¨é£²ãã§ãéã«ããã°ã©ãã³ã°è¨èªãåå¼·ãã¦
使ããããã«ãªã£ãã®ãªããã£ãããããããæ¸ãã¦å½ããå
ãã£ããããã¯åæ©ã®åæ©ã®åæ©ï¼ã¨ããäºãè¨ãããã®ã§
ã¡ãã£ã¨å¿é
ã«ãªãã¾ãã
ãªã®ã§ä»ã¾ã§åå¼·ãã¦ããè¨èªã§ãã£ãããããæ¸ããã¨æ±ºãã¾ãã
Haskellã¯éä¸ã ãSICPã1ç« ã¾ã§ããèªãã§ãªããPythonã¯ç¾å¨é²è¡ä¸ã§ãã
ããã¨æ±ºããã®ã§!!!!
ãã£ããããã¯å
¬å¼ã¯è¦ãã¦ãã®ã§ããã¡ããã¨å
容ãè¦ãã¦ããªãã£ãã®ã§
ã³ã³ã§ããä¸åº¦æ¦è¦ãææ¡
æ åå¼ (Fn-1)+(Fn-2)ããã ãF(0)=0 F(1)=1
Fnã®1ã¤åã¨2ã¤åã®çãã足ãããã®ãFnã«ãªãã®ã§ãã
ç§ã¯ãã®è¾ºæ®éã«ééã£ãäºãè¨ã£ã¦ãã¾ããw
ãã¦ãããschemeã§æ¸ã訳ã§ããç§ã¯ã«ã¦ã³ã¿ã¼ç©ãªã©ã
ã¡ããã¨ä½¿ããªãã®ã§condã使ãã¾ãã
(define (fib n) (cond ((= n 0) 0) ãããã((= n 1) 1) ãããã(else (+ (fib (- n 1)) (fib (- n 2))))))
4è¡ç®ã®fibãæåæ¸ãå¿ãã¦ã¾ãããcond~hoge else~ã¨æ¸ã
ææ³ã®ã»ãã§ã¯ãã¾ãæéãããããã«ããã¾ãã
(emacsããã®ã³ãããã¹ããã¦ãåã®æéããã£ãããorz)
ããã¦condæã®æ¸ãæ¹ã¯ãã¨ãã1種é¡cond(fuga1)...(hoge1)
ã®ãããªæ¸ãæ¹ãããã®ã§ãã¡ãããããã¯ãã¨æã£ã¦æ¸ãã¦ãã¾ããã
ãªããªããããªãã¦ããªãè¿·èµ°ãã¾ãã
define (fib n) (cond ((= n 0) 0) ((= n 1) 1) ((< n 2) (+ (fib (- n 2))(fib(- n 1)))))
æåã®ã»ãã§ãããªã³ã¼ããæ¸ãã¦ã¦
æ¬å½ã¯nâ¦2ã表ç¾ãããã®ã«ä¸ã®ã³ã¼ãã ã¨å
¨ç¶ã ãã§ããã
n=2ã®æã¯ã©ããªã£ã¦ãã¾ãã®ï¼ã¿ãããªã»ã»ã»
ããã§æ¬¡ã«æ¸ããã³ã¼ã
(define (fib n) (cond ((= n 0) 0) ((= n 1) 1) ((=< n 2)(+ (fib (- n 1)) (fib (- n 2))))))
ã¾ããããerrorãªãã§ããã©(=< n 2)ããããã
ããã§ä»åº¦ã¯=<ã®ç¬¦å·ãå¥ã
ã«ãã¦<ã¨>ã®ç¬¦å·ã®åããéã£ã¦ãã®ã§
ãããç´ããã大ä¸å¤«ã ããã¨èãã¾ãã
(define (fib n) (cond ((= n 0) 0) ((= n 1) 1) (= (> n 2) (+ (fib (- n 1)) (fib (- n 2))))))
ã¡ããã¨çãè¿ãã¦ãã!!
ã³ã¬ã§å®å¿ãã¦ä»ææ¹å¯ã訳ãªãã§ããã©ãã®ã³ã¼ããä¸å¯è§£ã¨ã®
ãææãããèãã¦ã¿ã¾ãã
ãã®ã³ã¼ãã§ã¡ããã¨çãã¯è¿ãã¦æ¥ããã§ã
ç§çã«ã¯(> n 2)ã§ãããªãã° (+ (fib (- n 1)) (fib (- n 2)))ã¨=ã¨ã¿ãªãã¦
çããè¿ãã¦ããã¨æã£ã¦ãã®ã§ãããã®ã³ã¼ããèªã¿ç´ãã¦ã¿ãã¨
(= (> n 2) (+ (fib (- n 1)) (fib (- n 2)))
æ¬å¼§ã®ä½ç½®ãããããããï¼
ç§ãããããã£ãã®ã¯(n)ã®å ´åã¯(m)ã¨è¿ãã¨ããã³ã¼ããªã®ã ããã»ã»ã»
ãªã®ã§æ¸ãç´ããªã
(= (> n 2)) (+ (fib (- n 1)) (fib (- n 2))
ã¨ãªã£ã¦goshã§ã¯#tãè¿ã£ã¦æ¥ã
ãããã¾ãææãããããã«=ã«å¯¾å¿ããã¢ãããªãã¨ããäºã¨
å¤ãtrueã§ãããªãã°=ãè¿ãã£ã¦äºããªï¼ï¼
ãã®è¾ºèãã¦ããã©ãã£ã±ãåãã£ã¦ãªãã¨æã
ããã¦ä»¥ä¸ã®äºãè¸ã¾ãã¦ãããã³ã¼ãããã
(define (fib n) (cond ((= n 0) 0) ((= n 1) 1) ((>= n 2)(+ (fib (- n 1)) (fib (- n 2))))))
>=ã ã¨å¤§ä¸å¤«ã ãã©=>ãªãerrorã§ã
ãã®è¾ºã¯ç¬¦å·ã®åªå
é ä½ã®åé¡ã ã¨æãã®ã§ã¾ããããã»ã»ã»
ä¸çªç°¡åã«æ¸ããã¯ãã®schemeã®ãã£ããããã§ãããªã«èºãã¦ã¦
Haskellã¨ãPythonã§æ¸ããã®ãå¿é
ã«ãªã£ã¦æ¥ãã»ã»ã»orz
ä½èª¿æªããªã®ã§Haskellã®åã¯ææ¥ä¸ã«æ¸ããã°ããã£ã¦äºã«æ±ºãã¾ããï¼
追è¨ãâ¯ç·å½¢å復ããã»ã¹ãÃã«ã¦ã³ã¿ã¼ç©ãåããã«ããã¦ã´ã¡ã³ããµã¤
æ°ãã¤ãããåã質åãå度ãã¦ããã®ã§å¿ããªãããã«ã¡ã¢
æè¿ghcã®èª¿åãæªããã§ã
ãã®åãcat.hsãemacsã§æ¸ãã¦runghcã§ã¿ã¼ããã«ä¸ã§
å®è¡ããããã¨æã£ããå®è¡ããªããghcãçµäºããªã
ãã®ç¶æ
ãã©ãã«ããããã£ãã®ã§Haskellã®å¸«å ã§ããã
id:ujihisaããã«ç¸è«ããã¦ãªãã¨ã解決ããã®ã§ãã
ç§ã®ghcãããããã£ãçç±ã¯
æ¨æºå
¥åããã®ãããã¡ãªã³ã°ããªã«ãããããã¨ã®äºã§ãã
解決çã¨ãã¦ä¸æ¦ãã¤ããéã«æãäºã§ãããã¡ããªãããã«ããã大ä¸å¤«ã«ãªãã¾ãã
ããã¦ä»åã¯2ã3è¡ãããªãã³ã¼ãã ã£ãã®ã§ghciã使ã£ã¦ããã§ããã©
絶対ã«éãã¯ãã®ã³ã¼ãã¾ã§éããªãï¼ï¼
ããã§ã¾ãujihisaããã«ghciãããããã¨ãã話ãããã
ghci㯠main = do print $ ... print $ ... åè¡ããã®...ã®ã¨ãã«å ¥ããããªæãã§å¦çãããã¨æãã°OK ç´ ã®Haskellãæ¸ãã®ã¨ã¯éããã¼
ã¨ã®äºã ã£ãã®ã§ããå®ã¯ãã®å¾éè¦ãªäºã«æ°ä»ãã¡ããã¾ããorz
å®ã¯ã»ã»ã»ã»ã¼åã質å2åç®ï¼ï¼ï¼
ç§ã£ã¦å¦ç¿è½åãªããã»ã»ã»
ç§ã®ãã¼ãã«ããã¨
[ghci使ãæã¯letã使ããã¨ã«ãã使ãããã¾ããªã]
ã£ã¦æ¸ãã¦ããã¾ããã»ã»ã»
æ´ã«ãã®é ã¯vimã使ã£ã¦ãã¦ghcã®ã»ãã使ã£ã¦ã¦
ä½ã£ããã¡ã¤ã«ï¼2åã®ã³ã³ãã¤ã«ãéããã¡ã¤ã«ãã§ãã¡ãã£ã¦
æ¯åå°æãã¦ãã®ãæãåºãã¾ããw
ããåã質åããªãããã«æãçã¡ã¢ã¨ãã¦æ¸ãã¾ããâ
æ ãããï¼
ãåºããããæã¯å¤§ä½æ¬1åã¨ãã¼ãPCãæã£ã¦è¡ãäºã«ãã¦ãã
é»è»ã«ä¹ã£ã¦ãæãæéã空ããæããåå¼·ããã®ã«ã¯å¿
éåã ãã
ã¨ããçç±ãªãã§ããã»ã»ã»å¥ããã¯ãæããªãã¨å
¥ããªãã
ã«ã¯ã¤ã¤ããã¯ããªããªã使ããªãäºãããã®ã§ãã®äºæ
ãä½ã¨ããããï¼
ã¨æãiPhoneã ãã§ãåºããåºæ¥ãæ¹æ³ãèããããã¦ã¿ã¾ãã
PCã§ä½¿ã£ã¦ã¦iPhoneã§ä½¿ã£ã¦ãªãã®ã¯ã·ã§ã«ãªã®ã§iPhoneã§ããã¦
ã¤ã³ã¿ããªã¿ããã使ããªãããªã¨ãæ¬ã¯éãããé»åæ¸ç±å
ã¾ãã¯PDFåããããªã¨ãæã£ã¦ä¸èª¿ã¹ãªã©ãã¦ã¾ãã
ã·ã§ã«ã¯iPhoneãã使ããããã«ãªãã®ã§ããã¡ãã£ã¨
å
¥åãé¢åãªã®ã§ãã£ã±ãPCæã¡éã³ã«ãªããããªäºæ
æ¬ã«ã¤ãã¦ã¯ã¹ãã£ãã§åãè¾¼ãã°ããããï¼ã¨ãèãã¦ããã§ãã
ã¹ãã£ãã§åãè¾¼ãããã«ã¯æ¬ãã°ãããªãã¡ããããªãã¨ãããã¨ã
å
¨ãã¢ã¿ãã«å
¥ã£ã¦ç¡ãã¦ãã£ããæ念ã»ã»ã»
æ¬ãã°ããã®ã¯å«ãªã®ã§ç¡çã§ãã»ã»ã»
ãã®ã¾ã¾ããã©ããããåºããããæã®è·ç©ã®è»½æ¸ã¯ç¡çããª
ãã©æ¥½ãããï¼
æè¿å®å®¶ã«å¸°çããéã«å人ã¨éãã§ããéã«è¨ããããã§ããã©
ç§ã¯å¤§äººã«ãªã£ã¦ãç¸å¤ãããå¤ãªåã£ã¦è¨ããã¡ããã¾ããorz
ç¸å¤ããã大人ã«ãªã£ã¦ã夢è¦ãå°å¥³ã®ãããªå¿ãæã£ã¦ãããã§ãã»ã»ã»
ä»ç§ãåå¼·ãã¦ãäºã¨ã楽ããã¨æã£ã¦ããäºããããã話ãã¦ãããã§ããã©
ã©ãããæ®éï¼ã®æè¦ã¨ã¯çµæ§æãé¢ãã¦ãããã§ã(ï¾âï¾lll)
æ®éã£ã½ãè¦ãããããã«ããã¯åªåãã¹ããªã®ããª(ç¬)
ã¿ã¹ã¯
ã¡ãã£ã¨æ ãã¦ãã¨ããã¯ãªãããããã¿ã¹ã¯ãè¨ãä¸ãã£ã¦
ããªãé å¼µããªãã¨æ¶è²»åºæ¥ãªãç¶æ
ã«ãªã£ã¦ãã¾ã
ããæ°ããªãæãä½èª¿ãå´©ããæã¯ã¿ã¹ã¯ãè¨ãä¸ããããã¦
ã©ãã©ãè² ã®ã¹ãã¤ã©ã«ã«ãªã£ã¦ãã£ã¦ãã¾ã
ãã¨ãã¾ã«ã¿ã¹ã¯ã«ãããäºãå¿ãã¦ãã¾ã£ãä½æ¥ãªã©ã®ç· ãåããè¿«ã£ã¦
é¸æè¢ãããªãçãã¦ãã¾ãå ´åããã
ã ããæè¿ã¯iPhoneã®ã¡ã¢ã«ã¿ã¹ã¯ãã©ãã©ãæ¸ãè¾¼ãã§
æ¶è²»ãã¦ããããã«ãã¦ãã
iPhoneã¯æ¯æ¥å¿
ããã§ãã¯ããã使ããã®ãªã®ã§MacBookã§
ã¿ã¹ã¯ã管çããããããªãå¹ççã ã¨æã
ãã ããã¾ã§ã¡ã¢ãªã®ã§ã¿ã¹ã¯ã管çãããã§ãã¯ããã¯ã¹ã
åªå
é ä½ã®æ ¼ä»ããªã©ãåºæ¥ãªãäºãä¸æºç¹ã§ã¯ãã
ãªã®ã§iPhoneã¢ããªã§ã¿ã¹ã¯ç®¡çé¢ä¿ã®ãã®ãæ¢ãã¦ã¿ãããã¨æã£ã¦ãã
ä½ç½®æ
å ±ã®é¢ä¿ã§çµå±ã¾ã 使ãã¦ããªãã»ã«ã¤ã«ã¡ã©
ææ¥ã¨ãæå¾æ¥ãããã«å°ãé åºãã¦ä½¿ã£ã¦ã¿ãããªã
ã»ã«ã¤ã«ã¡ã©
ã»ã«ã¤ã«ã¡ã©ãiPhoneã«å
¥ãã¾ããâ
æ©ééã¼ãã¨æã£ããã§ããã»ã»ã»
1.端æ«æ å ±ã使ã 2.ç¾å¨ä½ç½®ãåå¾ãã¦ä½¿ã
1ã¯ããã¨ãã¦ã2ã¯ã¡ãã£ã¨ã»ã»ã»ç¡çããã»ã»ã»
ã¨ã¢ã¿ã°ãã¤ãã¦ãã¾ããèªå®
ï¼ãã®å¨è¾ºã§ã¯ã¡ãã£ã¨ä½¿ããªããã
ã¨ã¯ããä¸å¿ã»ããã¢ããã¯ãã¦ããã¾ãã
誰ãå®éã«ä½¿ã£ã¦ã¿ã人ãæ¢ãï¼ä½é¨è
ã®ããã°æ¢ãããã¦ãããªãï¼