schemeã§å ¨dataã+ããã®ãç¥ãããã§ãããï¼
http://detail.chiebukuro.yahoo.co.jp/qa/question_detail/q1347295398
ã¨ããããä»æ§ãæºãããã®ãã¬ã¬ãã¨åä»»ãã«æ¸ãã¦ã¿ãã
(define (mysum lst) (define (iter lst) (if (null? lst) 0 (let ((head (car lst)) (tail (cdr lst))) (+ (iter tail) (if (number? head) head (iter head)))))) (if (list? lst) (iter lst) (error))) (define (mytrans lst) (define (iter lst) (if (null? lst) '() (let ((head (car lst)) (tail (cdr lst))) (if (number? head) (cons (alpha head) (iter tail)) (cons (iter head) (iter tail)))))) (define (alpha n) (cond ((= n 1) 'one) ((= n 2) 'two) ((= n 3) 'three) ((= n 4) 'four) ((= n 5) 'five) ((= n 6) 'six) ((= n 7) 'seven) ((= n 8) 'eight) ((= n 9) 'nine))) (cond ((number? lst)(error)) ((null? lst) 0) (else (iter lst)))) (define (myfind lst n) (let ((result (assoc n lst))) (if result (cadr result) #f)))
ã追è¨ã
ãã£ã¨ãã£ã¡ãããã®ãæ¸ãã¦ããã¦ã
â http://d.hatena.ne.jp/trotr/20100921/1285082372
valvallowããã®æ½è±¡åãã¼ã¸ã§ã³
â http://valvallow.blogspot.com/2010/09/re-schemedata.html
第208å ç´ äººãããSICPèªæ¸ä¼ï¼at ä¸ç°ææï¼
- ä¼å ´æä¾ãããã¨ããããã¾ãã
- åå ã¯3人
- è¶ ä¹ ãã¶ãã«SICPãããã¾ãããåç
- åé¡5.23
- 以åãã£ãã¯ããªã®ã§å¾©ç¿
ev-cond (assign exp (op cond->if) (reg exp) (goto (label eval-dispatch)) ev-let (assign exp (op let->combination) (reg exp) (goto (label eval-dispatch))
- åé¡5.24
- åé¡5.23ã®æ©è½ãã³ã¼ãçµã¿è¾¼ã¿ã§ãã¡ãã¨æ¸ãä¸ãåé¡
第2å ããããPAIPèªæ¸ä¼ï¼at ä¸ç°ææï¼
- ä¼å ´æä¾ãããã¨ããããã¾ãã
- å½åãæºã¯ãªãäºå®ã ã£ããã©ãæºãç¨æãã¦ããã¦ãããããã¨ããããã¾ã
- åå 表æ20人ä¸ãå®éã®åå ã¯18åããã¿ãã£ã³çä½ããªããæ¥æããã®èª¿åã§ãé¡ããã¾ã
- ç½ç¶ãã¾ããå½æ¥ã®ååã¾ã§å ¨ãæºåãã¦ã¾ããã§ãããããããªãã
- åå¾ã®ç©ºãæéã«æ¥ãã§ã¹ã©ã¤ãä½ã£ã¦sbclãã¤ã³ã¹ãã¼ã«ãããæºç«¹è¿«ã¡ã½ãã
- åçç¹ããã®èª¬æããå帰ã«æ £ãã¦ãªã人ã¯çµ¶å¯¾ã«ç解ã§ããªãããã1.2ã§ä¾ã«æããnã®æ°ããã£ã¨æ¸ããã¦å®éã«çæãããå±éå¼ã示ãã°ããã£ã
- ãããçºè¡¨ããã¦çªã£è¾¼ã¾ããã®ã¯ãã¤ãã®è¸é¢¨ãªã®ã§ããã®ç¹ã¯ã¾ãããã¨
- ããã¹ãã¨ãã£ããããEmacsã¸ã®ã³ããã¯èªåã§ããããã«ã²ã©ãã¨æãããEmacs使ãã«æ®ºãããããã¨è¨ããã¾ãããããã¦Emacså ã§ã¦ã£ã³ãã¦ãåãã¦ã³ãããã¨ã
- ãTODOã次åã¾ã§ã«SLIMEå ¥ãã¦ã¾ã¨ããªç°å¢ã«è¿ã¥ãã
- 1.10é³èª â 第1ç« å ¨ä½ã®ç°¡åãªã¾ã¨ã â æ¼ç¿åé¡ã®è§£èª¬ã¨ããæµã
PAIP 第1ç« Lispå
¥é
View more presentations from yadokari electric.
- ããã¥ã¡ã³ãã¼ã·ã§ã³æååã¯ãã ã®æ³¨éãããªãã¦ããã°ã©ã ã§æä½ã§ãããã¨ã
- ãfourthããééã£ã¦ãforthãã¨æ¸ãã¦ãâ¦
- æ¼ç¿1.1
- åºæ¬çã«ã¯15ãã¼ã¸ã®first-nameãæ¸ãæãã¦last-nameãä½ãã ã
- 注æç¹ã¯lastãè¿ãã®ã¯ãªã¹ãã ã¨ããç¹ããã
- æå¾ã®è¦ç´ ãåãã®ã¯ã(reverse (cdr (reverse â¦ã¨æ¸ãããã®ããã£ã¨ãããã¦butlastã使ç¨
- Downey,ã®ã,ããã©ãåãããååã®ã¨ããã§ãDowney |,| Jr.ãã¨ãã«ãã¦ããã°ãåé¤åè£ã«ã|,|ããå ¥ãã¦ãããã¨ã§åããã¨ã®ãã¨ãåé¡ã®è¶£æ¨ã¨ãã¦ã¯ãããªãã¨ã¾ã§èããªãã¦ããããã ãã©
- æ¼ç¿1.2
- éä¹ã®ããã°ã©ã ãæ¸ãã¨ãã«çµã¿è¾¼ã¿ã®éä¹é¢æ°ã§ããexptã使ãã®ã¯ããã¾ããªã®ã§ã解çã®(expt x 2)ã®ã¨ããã¯ã(* x x)ã¨ãã¦å®ç¾©ããsquareã使ç¨
- dotimesã使ã£ããã¤ã¼ããªã«ã¼ãçãç¨æããã«ã¼ãçããå帰ï¼æé©åçããçµã¿è¾¼ã¿ã®exptãã®æ§è½ã5ã®20ä¸ä¹ã«ãããæéã§æ¯è¼ãã¦ã¿ã
- ã«ã¼ãçã7.041ç§
- å帰ï¼æé©åçã0.278ç§
- çµã¿è¾¼ã¿ã®exptã0.315ç§
- å帰ï¼æé©åçã®å§å
- çµã¿è¾¼ã¿ã®exptã®ã»ããé ãã®ã¯ãæ´æ°ä¹ã ããããªãã¦å®æ°ä¹ã¨ãããµãã¼ããã¦ããããã ã¨æãã
- æ¼ç¿1.3
- ãä½ã®å¦çãæ¸ãã¦ãªããã£ã¦è¨ã£ãããããã¥ã¡ã³ãã¼ã·ã§ã³æååã«ã¡ããã¨æ¸ãã¦ãããã¨è¨ããã orz
- ä¸ã®ãnilãæ°ããçãã®ãªãã·ã§ãã«å¼æ°ã®ä½¿ãæ¹ãããããããå帰ã®éã®ãã©ã°ã«ä½¿ã£ã¦ã
- ãã ãããã¾ããããªãæ¸ãæ¹ã誤åä½ãå¼ãèµ·ããå¯è½æ§ã®ãããªãã·ã§ãã«å¼æ°ãå¤é¨ã«ãããã®ã¯å±éºã¨ä½éããããææ
- æ¼ç¿1.4
- åºæ¬çã«ã¯åé¡1.3ã¨ã»ã¨ãã©å¤ãããªã
- æ¼ç¿1.5
- å帰çãã«ã¼ãçãé«éé¢æ°çã®ä¸ã¤ã®ãã¼ã¸ã§ã³ã解çã«ç¤ºããã¦ã
- ãªã¹ãaã¨ãªã¹ãbã®é·ããéãå ´åãã«ã¼ãçã¯ã¨ã©ã¼ã«ãªãå¯è½æ§ãããã¨åå è ããã®ææããããã«ã«ã¼ãçã§ã¯ãªã¹ãaã®é·ãããè¦ã¦ããªãã®ã§ããªã¹ãbããªã¹ãaããçãå ´åã¯ãã°ã
ã次åçºè¡¨è ã
- 第2ç« æ¬æãyshigeruãã
- æ¼ç¿2.1ãiori0121ãã
- æ¼ç¿2.2ãkurohukuãã
- æ¼ç¿2.3ãsnmstsãã
- æ¼ç¿2.4ãç§
第1å ããããPAIPèªæ¸ä¼ï¼at æ島ææï¼
- ä¼å ´æä¾ãããã¨ããããã¾ãã
- 第1回 やさしいPAIP読書会 : ATNDã«ç»é²ãã23人ã®ãã¡ã20人ï¼1人ï¼21人ãåå ããã¿ãã£ã³ã¯äºæ³ãã¦ããããããªãå°ãªãã£ã
- é çªã«1ç« ãé³èªãã¦ãã£ã
- 誤æ¤ã2åæè¦ã¤ãã£ãã13ãã¼ã¸ã®ä¸çªä¸ã§æå¾ã®ã«ãã³ã1åå¤ãã®ã¨ã15ãã¼ã¸ã®first-nameé¢æ°ã®å®ç¾©ã®ä¸ã§æå¾ã®ãfirst-nameãã¯ãfirst nameã
- èªã¿çµãã£ãã®ã¯1.8ã¾ã§
- firstãsecondâ¦ã¨nthã®è©±
- é¢æ°ã¨å¤æ°ã®åå空éãåããã¦ãã®ã¯ã©ããã¨ãã話
- ç¡åé¢æ°å ã§èªåèªèº«ãå¼ã³åºã話ãOn Lispã®alambdaãã¯ãã¨ãï¼nitro_idiotãããここã«ã¾ã¨ãã¦ããã¦ãï¼
- çµãã£ãå¾ã¯10人ã§ãããã
- 1人ã«ã¤ã1åãããããé ¼ãã ã®ã¯å¤ããã ã£ããæºè ¹ããï¼æéããããããä»åº¦ãã3人ã§2åãä¸éã«é ¼ãã®ãããã
- todoï¼k.hibinoããã¨nitro_idiotããã«510åãã¤è¿é
ã課é¡ã
- 2æéã¨ããéãããæéã§é³èªããã®ã¯ããªãå¹çãæªãæã
- äºæ³ããã¦ãããã¨ã ãã©ããã£ã±ãåå è ã®ã¬ãã«å·®ãããªãããå°è±¡ããã¶ããLispãããã人ã«ã¨ã£ã¦ã¯æãããã§ãããããªã人ã¯ã³ã¼ãã追ããªãã£ãã¨æã
- ãã¼ã¹ãä¸ãããéå¬é »åº¦ãä¸ããã
- éå¬ãæ2åã«ããã®ã¯åå è ã«ã¨ã£ã¦ãä¼å ´ç¢ºä¿ã®é¢ã§ãé£ããããªæ触
- ã¨ãããã¨ã§ãé³èªå»æ¢ã®æ¹åã§
ã次å以éã
- çºè¡¨è ãå 容ãã¾ã¨ããå½¢å¼ã«ã¨ããããå¤ãã¦ã¿ã
- å®ã¯ãä»åã®ããã«ãåé¡1.2ã§ãã¤ã¼ããªã«ã¼ãã¨å帰ã§æé©åå ¥ããã®ã¨ã§ãããªã«æ§è½ãå¤ãããã¨ããç°¡åãªãã¢ãç¨æãã¦ããã ãã©ãæéçã«å ¨ç¶è¦ããããªãã£ãã次åã¯1ç« ã®ã¾ã¨ãã¨åé¡ã®è§£èª¬ãèªåãããæãããª
- ä¼å ´ã¯ã8æã¯å¼¾ããã®ãé½åãæªãã®ã§æ¢ãå¿ è¦ããã9æã¯ä»ã®ã¨ããã¯å¼¾ããå® ã®äºå®
Keccon2010ï¼åºå¸åç¹ã»æ°¸ç°ç¥å çµå©ã«ã³ãã¡ã¬ã³ã¹ï¼
- 髪ã®èµ¤ã人ã¨ãã©ã®äººãã©ããããã¾ããããæããã¦ããããããã¨ã¦ãããä¼ã§ãã
- æ¼åºããããããã£ããã¹ã¿ããã®äººãã¡GJ
- 130人ãããæ¥ã¦ãããããããããª
- æ¥è¨ãæ´æ°ãã¦ãªãã¨ææããã¾ããï¼ï¼
- æããããªãã«ããã«ã«ã³ã£ãããããªã©ããå©ç´ããã§ã¨ããããã¾ãï¼
- ææ°ã®è»¢è·ãç¥ã£ã¦ã³ã£ãããããªã©
- ã¨ãããã¨ã§ãid:Yoshioriãããid:ngtykããããçµå©ããã§ã¨ããããã¾ãï¼
PRML復ç¿ã¬ã¼ã³ï¼ç¬¬3åï¼
- å¹¹äºã®naoya_tãããä¼å ´ã貸ãã¦ãã ãã£ãECãããããã©ãããããã¨ããããã¾ãã
- 復ç¿ã¬ã¼ã³çå¤ãç®æãããã¨ãæã£ã¦ãã®ã«ãããªã2åç®ã§åºå¼µã¨ãã¶ã£ã¦æ¶ç®ã第3åã¯ãªãã¨ãåå
- ç¬ãã§èªãã§ãã¨æ°å¼ã ããã§æ³£ããããªããã©ãããã£ã¦ã人ã«èª¬æãã¦ãããã¨ã¡ãã£ã¨ã ãããã£ããããªæ°ã«ãªãããèªæ¸ä¼åãã®æ¬ã ããªã¼
- ãã¤ãºæ¨è«ã®èãæ¹ã«å°ãã ãæ £ãã
- ãããå¾ãªãç¨äºâã§éä¸éå ´
第192å ç´ äººãããSICPèªæ¸ä¼ï¼at ä¸ç°ææï¼
- ä¼å ´æä¾ãããã¨ããããã¾ãã
- åå ã¯æå°æ§æ人æ°ã®2人
- 6æã®ç¬¬1é±ã¯æµ·å¤ã«ããå¯è½æ§ãããã®ã§ããã®å ´åã¯èªæ¸ä¼ã¯ä¼ã¿ã«ãããã¨ãã話
- ââã£ãã¼ãæµè¡ã£ã¦ããã¨ãã話ããè¡æ¶²åã®æ§æ ¼åé¡ã¯ã²ã©ããã¨ãã話ã«
- åé¡5.22
- éç ´å£çãªæ¹ã¯factã¨ã»ã¨ãã©åããfactãã¡ããã¡ããã£ã¨æ¸ãæãããåãã
(define append-machine (make-machine '(x y val continue) (list (list 'null? null?) (list 'cons cons) (list 'car car) (list 'cdr cdr)) '((assign continue (label append-done)) append-loop (test (op null?) (reg x)) (branch (label base-case)) (save continue) (save x) (assign x (op cdr) (reg x)) (assign continue (label after-append)) (goto (label append-loop)) after-append (restore x) (restore continue) (assign x (op car) (reg x)) (assign val (op cons) (reg x) (reg val)) (goto (reg continue)) base-case (assign val (reg y)) (goto (reg continue)) append-done)))
- ç ´å£çãªã»ãã¯ãæåã5.11ã¨åãããã«åç´ãªã«ã¼ãã«ãã¦ã¯ã¾ã£ã
- ããã ã¨cdrã§åã£ãã¨ããã復å ã§ããªããã¨ãããã¨ã§ãvalãä»ããå½¢ã«æ¸ãç´ã
- æ¸ãããã ãã©ãæå¾ã®è¦ç´ ã¨yãappendãããã®ããxã復å ããã«ã¯ã©ããããããããããããªãã¦ã¿ã¤ã ã¢ãã
- ã§å¸°ãéã«èãã¦ãããã»ã¨ãã©æ£è§£ãã¦ããã¨ã«æ°ä»ãã
- set-cdr! val yããæç¹ã§ãçãã¯xã«å ¥ã£ã¦ã
- ä½ã®ããã«xã復å ãããã ããã¢ãã ãªã¬
(define append!-machine (make-machine '(x y temp val continue) (list (list 'null? null?) (list 'cdr cdr) (list 'set-cdr! set-cdr!)) '((assign continue (label last-pair-done)) last-pair-loop (assign temp (op cdr) (reg x)) (test (op null?) (reg temp)) (branch (label base-case)) (save continue) (save x) (assign x (op cdr) (reg x)) (assign continue (label after-last-pair)) (goto (label last-pair-loop)) after-last-pair (restore x) (restore continue) (goto (reg continue)) base-case (assign val (reg x)) (goto (reg continue)) last-pair-done (perform (op set-cdr!) (reg val) (reg y))))) (define (test-append!-machine) (set-register-contents! append!-machine 'x '(a b c)) (set-register-contents! append!-machine 'y '(x y)) (start append!-machine) (get-register-contents append!-machine 'x)) ;;(test-append!-machine) => (a b c x y)
- ä½ãèµ·ãã¦ãã®ãææ¡ããã®ã§ãåç´ã«ã¼ãã«æ¸ãæãã
- ãã¶ããã£ã¡ãæ£è§£
(define append!-machine (make-machine '(x y temp x-last) (list (list 'null? null?) (list 'cdr cdr) (list 'set-cdr! set-cdr!)) '((assign x-last (reg x)) last-pair-loop (assign temp (op cdr) (reg x-last)) (test (op null?) (reg temp)) (branch (label last-pair-done)) (assign x-last (op cdr) (reg x-last)) (goto (label last-pair-loop)) last-pair-done (perform (op set-cdr!) (reg x-last) (reg y)))))
- ã¨ãããã¨ã§åé¡5.22 done