This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
; 初期値を受け取り、それを内包し、あとは | |
; "常に「足す数」を渡すと内包されている総数に足すlambda" | |
; を作って返せばよい | |
(define (make-accumulator total) | |
(lambda (addends) | |
(set! total (+ total addends)) | |
total)) | |
(use gauche.test) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
ssh-rsa AAAAB3NzaC1yc2EAAAADAQABAAABAQDfgfI6FSrEJepjgZPHFen3CtIi1rilee/IB3Mh5P/c8MlKAv6wePlJGAXunrg91BWUqZfZG7cgUSOWYjjr0DjnQkcw3qDjGUJ5FHh8L8bcpFPgg0Tluml3FQH3jQgz/8OX1LGF5wJUMMlHTk8AkmesxKLXv+KjEA/8UpC/DF+F963yWaV/yuvrnOX0eZCfXMJP+gbfPHW+RT8c6CaZISB7krZGfnwGqObENoFTaIeadcU2xTVYptcVduJ96gryWsWom7UEvf8cwELjDGA9boLiBR0hOSLJ4OTbbF5xogtmxEI8ljgFMfYNKK2kBNweKuw8FJ5FO8D5rSay6Ry05TI3 lesamoureuses@gmail.com |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
(define (make-from-mag-ang r a) | |
(define (dispatch op) | |
(cond ((eq? op 'real-part) (* r (cos a))) | |
((eq? op 'imag-part) (* r (sin a))) | |
((eq? op 'magnitude) r) | |
((eq? op 'angle) a) | |
(else | |
(error "Unknown op -- MAKE-FROM-REAL-IMAG" op)))) | |
dispatch) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
ssh-rsa AAAAB3NzaC1yc2EAAAADAQABAAABAQCl/gBStVjgW8IBEFxXXWvajjWpPC9xhoBXw4PN3YMd0109QRG7LDSRg5nVUNgxHGOXfLsgDKdT7GuH3HvXpn/wgi12Imu/I+NA6IJpMZqj1HLfs2JsunbqyRzDbConXjIR67FzyifnIESO6KmgAQCnTrM5f5IcLLUKSsAuskCbD3ZS78CHwgHXhwcYG+t2x29chcXyG6T8ypyxGFJS75IE7NfAtdkDPTMJCV2gsaGA9YLIn3Wq74FXdSzVIjCHF4zxQhsL2rnO0YBdsJZZ4HObSneQW4yy67x7IyT29G5PV1xQIV28dSpV7DdTQH2De6JLySmyerRofgBfBPIBJjx7 lesamoureuses@gmail.com |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
; 1 <= k < j < i <= n | |
; | |
; e.g.) | |
; s = 6 | |
; 1 + 2 + 3 = 6 | |
; | |
; s = 7 | |
; 1 + 2 + 4 = 7 | |
; | |
; s = 8 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
; まずp.71-72で以下のことまでは学習済み | |
(define nil '()) | |
(define (square x) (* x x)) | |
(define (divides? a b) | |
(= (remainder b a) 0)) | |
(define (smallest-divisor n) | |
(find-divisor n 2)) | |
(define (find-divisor n test-divisor) | |
(cond ((> (square test-divisor) n) n) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
(define nil '()) | |
(define (accumulate op initial sequence) | |
(if (null? sequence) | |
initial | |
(op (car sequence) | |
(accumulate op initial (cdr sequence))))) | |
(define fold-right accumulate) | |
(define (fold-left op initial sequence) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
(define nil '()) | |
(define (accumulate op initial sequence) | |
(if (null? sequence) | |
initial | |
(op (car sequence) | |
(accumulate op initial (cdr sequence))))) | |
(define fold-right accumulate) | |
(define (fold-left op initial sequence) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
(define nil '()) | |
(define (accumulate op initial sequence) | |
(if (null? sequence) | |
initial | |
(op (car sequence) | |
(accumulate op initial (cdr sequence))))) | |
(define (accumulate-n op init seqs) | |
(if (null? (car seqs)) |