<?xml version="1.0" encoding="UTF-8" ?><rdf:RDF 
  xmlns="http://purl.org/rss/1.0/"
  xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#"
  xmlns:atom="http://www.w3.org/2005/Atom"
  xmlns:dc="http://purl.org/dc/elements/1.1/"
  xml:lang="ja">
  <channel rdf:about="http://w.atwiki.jp/tar0_puzzle/">
    <title>S.O.W - SICPお勉強Wiki</title>
    <link>http://w.atwiki.jp/tar0_puzzle/</link>
    <atom:link href="https://w.atwiki.jp/tar0_puzzle/rss10.xml" rel="self" type="application/rss+xml" />
    <atom:link rel="hub" href="https://pubsubhubbub.appspot.com" />
    <description>S.O.W - SICPお勉強Wiki</description>

    <dc:language>ja</dc:language>
    <dc:date>2010-07-12T16:28:44+09:00</dc:date>
    <utime>1278919724</utime>

    <items>
      <rdf:Seq>
                <rdf:li rdf:resource="https://w.atwiki.jp/tar0_puzzle/pages/39.html" />
                <rdf:li rdf:resource="https://w.atwiki.jp/tar0_puzzle/pages/38.html" />
                <rdf:li rdf:resource="https://w.atwiki.jp/tar0_puzzle/pages/37.html" />
                <rdf:li rdf:resource="https://w.atwiki.jp/tar0_puzzle/pages/36.html" />
                <rdf:li rdf:resource="https://w.atwiki.jp/tar0_puzzle/pages/35.html" />
                <rdf:li rdf:resource="https://w.atwiki.jp/tar0_puzzle/pages/33.html" />
                <rdf:li rdf:resource="https://w.atwiki.jp/tar0_puzzle/pages/32.html" />
                <rdf:li rdf:resource="https://w.atwiki.jp/tar0_puzzle/pages/31.html" />
                <rdf:li rdf:resource="https://w.atwiki.jp/tar0_puzzle/pages/30.html" />
                <rdf:li rdf:resource="https://w.atwiki.jp/tar0_puzzle/pages/29.html" />
              </rdf:Seq>
    </items>
	
		
    
  </channel>
    <item rdf:about="https://w.atwiki.jp/tar0_puzzle/pages/39.html">
    <title>描画結果</title>
    <link>https://w.atwiki.jp/tar0_puzzle/pages/39.html</link>
    <description>
      * Picture Language
----
** Painter
#ref(painter.png)
#highlight(scheme){
;; rate倍に縮小してframeを中心に移動する
; (後でまともにする)
(define (reduction-center rate painter)
  (let ((origin (/ (- 1.0 rate) 2)))
    (transform-painter painter
		       (make-vect origin origin)
		       (make-vect (+ origin rate) origin)
		       (make-vect origin (+ origin rate)))))
(below (beside (reduction-center 0.8 outline) diagonal)
       (beside diamond wave))
}

** Corner-split
#ref(corner4.png)
#highlight(scheme){
(corner-split wave 4)
}
** Square-limit
#ref(squarelimit.png)
#highlight(scheme){
(square-limit wave 4)
}

Ruby-GDでつくってみたけれど, Gauche-GDで作り直したい

** おまけ
#ref(hoge2.gif)
#highlight(scheme){
;Gauche-GDにて作成。関数名が適当なのは気にしない
(define aho (lambda (x) (corner-split x 3)))
(define aho1 (lambda (x) (rotate90 (corner-split x 3))))
(define aho2 (lambda (x) (rotate180 (corner-split x 3))))
(define aho3 (lambda (x) (rotate270 (corner-split x 3))))
(define hoge (square-of-four aho1 aho    </description>
    <dc:date>2010-07-12T16:28:44+09:00</dc:date>
    <utime>1278919724</utime>
  </item>
    <item rdf:about="https://w.atwiki.jp/tar0_puzzle/pages/38.html">
    <title>Exercises 2.2.4</title>
    <link>https://w.atwiki.jp/tar0_puzzle/pages/38.html</link>
    <description>
      * Chapter 2.2.4
** Picture Language
- [[描画結果]]
----
#pcomment(reply, コメント/2.2.2)
----
** Exercise 2.44
#highlight(scheme){
(define (align-operator combiner op1 op2)
  (lambda (painter) (combiner (op1 painter) (op2 painter))))
(define align-vert (align-operator below identity identity))
(define align-horiz (align-operator beside identity identity))
(define (up-split painter n)
  (if (= n 0) painter
    (below painter (align-horiz (up-split painter (- n 1))))))
}
----
** Exercise 2.45
#highlight(scheme){
(define right-split (split beside below))
(define up-split (split below beside))
(define (split align-identity align-splitted)
  (define (splitter painter n)
    (if (= n 0) painter
      (align-identity painter
		      ((align-operator align-splitted)
		       (splitter painter (- n 1))))))
  splitter)
}
----
* 以降はFrame, Painterの実装について
** Exercise 2.46
#highlight(scheme){
; vector constructor and selectors
; vector operating procedures
(define make-vec    </description>
    <dc:date>2010-06-25T14:07:23+09:00</dc:date>
    <utime>1277442443</utime>
  </item>
    <item rdf:about="https://w.atwiki.jp/tar0_puzzle/pages/37.html">
    <title>Exercises 2.2.2</title>
    <link>https://w.atwiki.jp/tar0_puzzle/pages/37.html</link>
    <description>
      * Chapter 2.2.2
----
#pcomment(reply, コメント/2.2.2)
----
** Exercise 2.24
#highlight(scheme){
(define ans (cons 1 (cons (cons 2 (cons (cons 3 (cons 4 &#039;())) &#039;())) &#039;())))
}
----
** Exercise 2.25
#highlight(scheme){
(define (pick x ls)
  (define (sub x ls)
    (if (null? ls) false
        (if (pair? ls) (pick x ls) (if (= x ls) true false))))
  (if (not (sub x (car ls))) (sub x (cdr ls)) true))
}
----
** Exercise 2.26
#highlight(scheme){
&gt; (define x (list 1 2 3))
&gt; (define y (list 4 5 6))
&gt; (append x y)
(1 2 3 4 5 6)
&gt; (cons x y)
((1 2 3) 4 5 6)
&gt; (list x y)
((1 2 3) (4 5 6))
}
----
** Exercise 2.27
#highlight(scheme){
(define (rev ls)
  (define (it ls re)
    (if (null? ls) re (it (cdr ls) (cons (car ls) re))))
  (it ls &#039;()))
(define (d-rev ls)
  (define (it ls re)
    (if (null? ls) re
        (if (pair? (car ls))
            (it (cdr ls) (cons (d-rev (car ls)) re))
            (it (cdr ls) (cons (car ls) re)))))
  (it ls &#039;()))
}
----
** Exerci    </description>
    <dc:date>2010-05-26T04:33:59+09:00</dc:date>
    <utime>1274816039</utime>
  </item>
    <item rdf:about="https://w.atwiki.jp/tar0_puzzle/pages/36.html">
    <title>コメント/2.2  Hierarchical Data and the Closure Property</title>
    <link>https://w.atwiki.jp/tar0_puzzle/pages/36.html</link>
    <description>
      -問題数が多いので分割します - jout 2010-04-03 16:27:09      </description>
    <dc:date>2010-04-03T16:27:09+09:00</dc:date>
    <utime>1270279629</utime>
  </item>
    <item rdf:about="https://w.atwiki.jp/tar0_puzzle/pages/35.html">
    <title>Exercises 2.2.1</title>
    <link>https://w.atwiki.jp/tar0_puzzle/pages/35.html</link>
    <description>
      * Chapter 2.2.1
----
#pcomment(reply, コメント/2.2.1)
----
** Exercise 2.17
#highlight(scheme){
(define (last-pair ls) (if (null? (cdr ls)) (car ls) (last-pair (cdr ls))))
}
----
** Exercise 2.18
#highlight(scheme){
(define (rev ls)
  (define (iter ls re)
    (if (null? (cdr ls))
        (cons (car ls) re)
        (iter (cdr ls) (cons (car ls) re))))
  (iter (cdr ls) (cons (car ls) &#039;())))
}
----
** Exercise 2.19
#highlight(scheme){
(define us-coins (list 50 25 10 5 1))
(define uk-coins (list 100 50 20 10 5 2 1 0.5))
(define (cc amount coin-values)
  (define (first-denomination coin) (car coin))
  (define (no-more? coin) (null? coin))
  (define (except-first-denomination coin) (cdr coin))
  (cond ((= amount 0) 1)
        ((or (&lt; amount 0) (no-more? coin-values)) 0)
        (else
         (+ (cc amount
                (except-first-denomination coin-values))
            (cc (- amount
                   (first-denomination coin-values))
                coin-v    </description>
    <dc:date>2010-04-03T16:29:35+09:00</dc:date>
    <utime>1270279775</utime>
  </item>
    <item rdf:about="https://w.atwiki.jp/tar0_puzzle/pages/33.html">
    <title>2.2  Hierarchical Data and the Closure Property</title>
    <link>https://w.atwiki.jp/tar0_puzzle/pages/33.html</link>
    <description>
      *Chapter 2.2
**[[Exercises 2.2.1]]
**[[Exercises 2.2.2]]
**[[Exercises 2.2.4]]
**Note

#pcomment()    </description>
    <dc:date>2010-06-25T13:57:40+09:00</dc:date>
    <utime>1277441860</utime>
  </item>
    <item rdf:about="https://w.atwiki.jp/tar0_puzzle/pages/32.html">
    <title>Exercises 2.1</title>
    <link>https://w.atwiki.jp/tar0_puzzle/pages/32.html</link>
    <description>
      * Chapter 2.1
----
#pcomment(reply,コメント/2.1)
----
**Exercise 2.1
#highlight(scheme){
(define (make-rat n d)
  (define (cons-rat n d)
    (let ((g (gcd n d))) (cons (/ n g) (/ d g))))
  (if (&lt; (* n d) 0) (cons-rat (- (abs n)) (abs d))
      (cons-rat (abs n) (abs d))))
}
----
**Exercise 2.2
#highlight(scheme){
(define (average x y) (/ (+ x y) 2))
(define (make-segment p q) (cons p q))
(define (start-segment seg) (car seg))
(define (end-segment seg) (cdr seg))

(define (make-point x y) (cons x y))
(define (x-point p) (car p))
(define (y-point p) (cdr p))

(define (midpoint-segment s)
  (let ((p (start-segment s))
	(q (end-segment s)))
    (make-point (average (x-point p) (x-point q))
		(average (y-point p) (y-point q)))))
}
----
**Exercise  2.3
----
**Exercise 2.4
#highlight(scheme){
; cons,car,cdrを手続きで表現する
(define (cons2 x y) (lambda (m) (m x y)))
(define (car2 z) (z (lambda (a d) a)))
(define (cdr2 z) (z (lambda (a d) d)))
}
----
**Exercise 2.5    </description>
    <dc:date>2010-03-09T16:37:24+09:00</dc:date>
    <utime>1268120244</utime>
  </item>
    <item rdf:about="https://w.atwiki.jp/tar0_puzzle/pages/31.html">
    <title>2.1  Introduction to Data Abstraction</title>
    <link>https://w.atwiki.jp/tar0_puzzle/pages/31.html</link>
    <description>
      *Chapter 2.1
**[[Exercises 2.1]]
**Note

#pcomment()    </description>
    <dc:date>2010-03-04T13:15:13+09:00</dc:date>
    <utime>1267676113</utime>
  </item>
    <item rdf:about="https://w.atwiki.jp/tar0_puzzle/pages/30.html">
    <title>コメント/1.3  Formulating Abstractions with Higher-Order Procedures</title>
    <link>https://w.atwiki.jp/tar0_puzzle/pages/30.html</link>
    <description>
      -1.3の日本語訳 ttp://www.comp.tmu.ac.jp/morbier/sysa/1.3.html - tar0_t 2010-02-24 07:27:06      </description>
    <dc:date>2010-02-24T07:27:04+09:00</dc:date>
    <utime>1266964024</utime>
  </item>
    <item rdf:about="https://w.atwiki.jp/tar0_puzzle/pages/29.html">
    <title>Exercises 1.3</title>
    <link>https://w.atwiki.jp/tar0_puzzle/pages/29.html</link>
    <description>
      * Chapter 1.3
----
**Exercise 1.29
#highlight(,scheme){
(define (simpson f a b n)
  (if (and (&gt; n 0) (even? n)) (simpson-in f a b (/ (- b a) n))
    (simpson f a b (+ n 1))))
(define (simpson-in f a b h)
  (define (g x) (+ (f x) (* 2 (f (+ x h)))))
  (define (add-2h x) (+ x h h))
  (/ (* h
	(+ (f a)
	   (f b)
	   (* 4 (f (+ a h)))
	   (* 2 (sum g (add-2h a) add-2h (- b h)))))
     3))
}
- simpson手続きはnが2以上の偶数になるまで, +1し続ける
- sum手続きの中身は, n≧2のとき下のΣの中身と同じ. n=2のときはf(a)+4f(a+h)+f(b)になる.
- [[シンプソンの公式&gt;http://ja.wikipedia.org/wiki/%E3%82%B7%E3%83%B3%E3%83%97%E3%82%BD%E3%83%B3%E3%81%AE%E5%85%AC%E5%BC%8F]]

#math(100){{
\int_{a}^{b}f \approx \frac{h}{3} \left( f(a) + 4f(a+h) + 2\sum_{k=1}^{n/2-1} \left( f(a+2kh) + 2f\left( a+(2k+1)h \right) \right + f(b) \right)
}}
#pcomment(reply,コメント/1.29)
----
**Exercise 1.30
#highlight(,scheme){
(define (sum f a next b)
  (define (iter a result)
    (if (&gt; a b) result
      (iter (next a) (+ result (f a)))))
  (iter a 0))
; 評価の    </description>
    <dc:date>2010-03-01T17:37:49+09:00</dc:date>
    <utime>1267432669</utime>
  </item>
  </rdf:RDF>
