乐正

Actions speak louder than words.

Sicp-ex2-50

问题

请定义变换flip-horiz,它能在水平方向上反转画家。再定义出对画家做逆时针上180度 和270度旋转的变换。

解答

练习2.50 (ex2-50.scm) download
1
2
3
4
5
6
7
8
9
10
11
12
13
14
(define (flip-horiz painter)
  (transform-painter painter
                     (make-vect 1.0 0)
                     (make-vect 0 0)
                     (make-vect 1.0 1.0)))

(define (rotate180 painter)
  (flip-vert painter))

(define (rotate270 painter)
  (transform-painter painter
                     (make-vect 0 1.0)
                     (make-vect 1.0 1.0)
                     (make-vect 0 0)))

draft

« 数据挖掘导论读书笔记-绪论 sicp-ex2-51 »

Comments