Dr Scheme Dr Scheme PLT Scheme Dr Scheme
![](https://slidetodoc.com/presentation_image/0ec26d9fc27a2435c769b5e426ac969d/image-1.jpg)
![](https://slidetodoc.com/presentation_image/0ec26d9fc27a2435c769b5e426ac969d/image-2.jpg)
![](https://slidetodoc.com/presentation_image/0ec26d9fc27a2435c769b5e426ac969d/image-3.jpg)
![](https://slidetodoc.com/presentation_image/0ec26d9fc27a2435c769b5e426ac969d/image-4.jpg)
![](https://slidetodoc.com/presentation_image/0ec26d9fc27a2435c769b5e426ac969d/image-5.jpg)
![](https://slidetodoc.com/presentation_image/0ec26d9fc27a2435c769b5e426ac969d/image-6.jpg)
![](https://slidetodoc.com/presentation_image/0ec26d9fc27a2435c769b5e426ac969d/image-7.jpg)
![](https://slidetodoc.com/presentation_image/0ec26d9fc27a2435c769b5e426ac969d/image-8.jpg)
![](https://slidetodoc.com/presentation_image/0ec26d9fc27a2435c769b5e426ac969d/image-9.jpg)
![Dr. Scheme の使用 • Dr. Scheme の起動 プログラム → PLT Scheme → Dr. Scheme • Dr. Scheme の使用 • Dr. Scheme の起動 プログラム → PLT Scheme → Dr. Scheme •](https://slidetodoc.com/presentation_image/0ec26d9fc27a2435c769b5e426ac969d/image-10.jpg)
![](https://slidetodoc.com/presentation_image/0ec26d9fc27a2435c769b5e426ac969d/image-11.jpg)
![](https://slidetodoc.com/presentation_image/0ec26d9fc27a2435c769b5e426ac969d/image-12.jpg)
![](https://slidetodoc.com/presentation_image/0ec26d9fc27a2435c769b5e426ac969d/image-13.jpg)
![](https://slidetodoc.com/presentation_image/0ec26d9fc27a2435c769b5e426ac969d/image-14.jpg)
![](https://slidetodoc.com/presentation_image/0ec26d9fc27a2435c769b5e426ac969d/image-15.jpg)
![](https://slidetodoc.com/presentation_image/0ec26d9fc27a2435c769b5e426ac969d/image-16.jpg)
![](https://slidetodoc.com/presentation_image/0ec26d9fc27a2435c769b5e426ac969d/image-17.jpg)
![](https://slidetodoc.com/presentation_image/0ec26d9fc27a2435c769b5e426ac969d/image-18.jpg)
![リストの総和 (define (list-sum a-list) (cond 終了条件 [(empty? a-list) 0]自明な解 [else (+ (first a-list) (list-sum リストの総和 (define (list-sum a-list) (cond 終了条件 [(empty? a-list) 0]自明な解 [else (+ (first a-list) (list-sum](https://slidetodoc.com/presentation_image/0ec26d9fc27a2435c769b5e426ac969d/image-19.jpg)
![No (empty? a-list) Yes (+ (first a-list) (list-sum (rest a-list))) 0 が自明な解である 20 No (empty? a-list) Yes (+ (first a-list) (list-sum (rest a-list))) 0 が自明な解である 20](https://slidetodoc.com/presentation_image/0ec26d9fc27a2435c769b5e426ac969d/image-20.jpg)
![リストの総和 list-sum • list-sum の内部に list-sum が登場 (define (list-sum a-list) (cond [(empty? a-list) 0] リストの総和 list-sum • list-sum の内部に list-sum が登場 (define (list-sum a-list) (cond [(empty? a-list) 0]](https://slidetodoc.com/presentation_image/0ec26d9fc27a2435c769b5e426ac969d/image-21.jpg)
![](https://slidetodoc.com/presentation_image/0ec26d9fc27a2435c769b5e426ac969d/image-22.jpg)
![](https://slidetodoc.com/presentation_image/0ec26d9fc27a2435c769b5e426ac969d/image-23.jpg)
![](https://slidetodoc.com/presentation_image/0ec26d9fc27a2435c769b5e426ac969d/image-24.jpg)
![(list-sum (list 1 2 3)) から (+ 1 (list 2 3)) が得られる過程 (list-sum (list (list-sum (list 1 2 3)) から (+ 1 (list 2 3)) が得られる過程 (list-sum (list](https://slidetodoc.com/presentation_image/0ec26d9fc27a2435c769b5e426ac969d/image-25.jpg)
![(list-sum (list 1 2 3)) から (+ 1 (list 2 3)) が得られる過程 (list-sum (list (list-sum (list 1 2 3)) から (+ 1 (list 2 3)) が得られる過程 (list-sum (list](https://slidetodoc.com/presentation_image/0ec26d9fc27a2435c769b5e426ac969d/image-26.jpg)
![(contains-5? (list 3 5 7 9)) から (contains-5? (list 5 7 9))が得られる過程 (list 3 (contains-5? (list 3 5 7 9)) から (contains-5? (list 5 7 9))が得られる過程 (list 3](https://slidetodoc.com/presentation_image/0ec26d9fc27a2435c769b5e426ac969d/image-27.jpg)
![](https://slidetodoc.com/presentation_image/0ec26d9fc27a2435c769b5e426ac969d/image-28.jpg)
![](https://slidetodoc.com/presentation_image/0ec26d9fc27a2435c769b5e426ac969d/image-29.jpg)
![「例題3.平均点」の手順 1. 次を「定義用ウインドウ」で,実行しなさい • 入力した後に,Execute ボタンを押す ; ; list-sum: list -> number ; ; 「例題3.平均点」の手順 1. 次を「定義用ウインドウ」で,実行しなさい • 入力した後に,Execute ボタンを押す ; ; list-sum: list -> number ; ;](https://slidetodoc.com/presentation_image/0ec26d9fc27a2435c769b5e426ac969d/image-30.jpg)
![](https://slidetodoc.com/presentation_image/0ec26d9fc27a2435c769b5e426ac969d/image-31.jpg)
![](https://slidetodoc.com/presentation_image/0ec26d9fc27a2435c769b5e426ac969d/image-32.jpg)
![](https://slidetodoc.com/presentation_image/0ec26d9fc27a2435c769b5e426ac969d/image-33.jpg)
![平均点のプログラム ; ; list-sum: list -> number ; ; total of a list ; 平均点のプログラム ; ; list-sum: list -> number ; ; total of a list ;](https://slidetodoc.com/presentation_image/0ec26d9fc27a2435c769b5e426ac969d/image-34.jpg)
![](https://slidetodoc.com/presentation_image/0ec26d9fc27a2435c769b5e426ac969d/image-35.jpg)
![](https://slidetodoc.com/presentation_image/0ec26d9fc27a2435c769b5e426ac969d/image-36.jpg)
![「例題4.ステップ実行」の手順 1. 次を「定義用ウインドウ」で,実行しなさい • Intermediate Student で実行すること • 入力した後に,Execute ボタンを押す ; ; list-sum: list 「例題4.ステップ実行」の手順 1. 次を「定義用ウインドウ」で,実行しなさい • Intermediate Student で実行すること • 入力した後に,Execute ボタンを押す ; ; list-sum: list](https://slidetodoc.com/presentation_image/0ec26d9fc27a2435c769b5e426ac969d/image-37.jpg)
![(average (list 40 90 80)) から 70 が得られる過程の概略 (average (list 40 90 80))最初の式 = (average (list 40 90 80)) から 70 が得られる過程の概略 (average (list 40 90 80))最初の式 =](https://slidetodoc.com/presentation_image/0ec26d9fc27a2435c769b5e426ac969d/image-38.jpg)
![(average (list 40 90 80)) から 70 が得られる過程の概略 (average (list 40 90 80)) = (average (list 40 90 80)) から 70 が得られる過程の概略 (average (list 40 90 80)) =](https://slidetodoc.com/presentation_image/0ec26d9fc27a2435c769b5e426ac969d/image-39.jpg)
![](https://slidetodoc.com/presentation_image/0ec26d9fc27a2435c769b5e426ac969d/image-40.jpg)
![「例題5.「5」を含むか調べる」の手順 1. 次を「定義用ウインドウ」で,実行しなさい • 入力した後に,Execute ボタンを押す ; ; contains-5? : list -> true or 「例題5.「5」を含むか調べる」の手順 1. 次を「定義用ウインドウ」で,実行しなさい • 入力した後に,Execute ボタンを押す ; ; contains-5? : list -> true or](https://slidetodoc.com/presentation_image/0ec26d9fc27a2435c769b5e426ac969d/image-41.jpg)
![](https://slidetodoc.com/presentation_image/0ec26d9fc27a2435c769b5e426ac969d/image-42.jpg)
![](https://slidetodoc.com/presentation_image/0ec26d9fc27a2435c769b5e426ac969d/image-43.jpg)
![](https://slidetodoc.com/presentation_image/0ec26d9fc27a2435c769b5e426ac969d/image-44.jpg)
![contains-5? 関数 ; ; contains-5? : list -> true or false ; ; it contains-5? 関数 ; ; contains-5? : list -> true or false ; ; it](https://slidetodoc.com/presentation_image/0ec26d9fc27a2435c769b5e426ac969d/image-45.jpg)
![](https://slidetodoc.com/presentation_image/0ec26d9fc27a2435c769b5e426ac969d/image-46.jpg)
![](https://slidetodoc.com/presentation_image/0ec26d9fc27a2435c769b5e426ac969d/image-47.jpg)
![「5」を含むか調べる ; ; contains-5? : list -> true or false ; ; it investigates 「5」を含むか調べる ; ; contains-5? : list -> true or false ; ; it investigates](https://slidetodoc.com/presentation_image/0ec26d9fc27a2435c769b5e426ac969d/image-48.jpg)
![(empty? a-list) Yes No (cond [(= (first a-list) 5) true] [else (contains-5? (rest a-list))] (empty? a-list) Yes No (cond [(= (first a-list) 5) true] [else (contains-5? (rest a-list))]](https://slidetodoc.com/presentation_image/0ec26d9fc27a2435c769b5e426ac969d/image-49.jpg)
![「5」を含むか調べる contains-5? • contains-5? の内部に contains-5? が登場 (define (contains-5? a-list) (cond [(empty? a-list) false] 「5」を含むか調べる contains-5? • contains-5? の内部に contains-5? が登場 (define (contains-5? a-list) (cond [(empty? a-list) false]](https://slidetodoc.com/presentation_image/0ec26d9fc27a2435c769b5e426ac969d/image-50.jpg)
![](https://slidetodoc.com/presentation_image/0ec26d9fc27a2435c769b5e426ac969d/image-51.jpg)
![](https://slidetodoc.com/presentation_image/0ec26d9fc27a2435c769b5e426ac969d/image-52.jpg)
![](https://slidetodoc.com/presentation_image/0ec26d9fc27a2435c769b5e426ac969d/image-53.jpg)
![(contains-5? (list 3 5 7 9)) から (contains-5? (list 5 7 9))が得られる過程 (list 3 (contains-5? (list 3 5 7 9)) から (contains-5? (list 5 7 9))が得られる過程 (list 3](https://slidetodoc.com/presentation_image/0ec26d9fc27a2435c769b5e426ac969d/image-54.jpg)
![(contains-5? (list 3 5 7 9)) から (contains-5? (list 5 7 9))が得られる過程 (list 3 (contains-5? (list 3 5 7 9)) から (contains-5? (list 5 7 9))が得られる過程 (list 3](https://slidetodoc.com/presentation_image/0ec26d9fc27a2435c769b5e426ac969d/image-55.jpg)
![](https://slidetodoc.com/presentation_image/0ec26d9fc27a2435c769b5e426ac969d/image-56.jpg)
![](https://slidetodoc.com/presentation_image/0ec26d9fc27a2435c769b5e426ac969d/image-57.jpg)
![](https://slidetodoc.com/presentation_image/0ec26d9fc27a2435c769b5e426ac969d/image-58.jpg)
![](https://slidetodoc.com/presentation_image/0ec26d9fc27a2435c769b5e426ac969d/image-59.jpg)
![](https://slidetodoc.com/presentation_image/0ec26d9fc27a2435c769b5e426ac969d/image-60.jpg)
![product 関数 ; ; product: list -> number ; ; inner product of two product 関数 ; ; product: list -> number ; ; inner product of two](https://slidetodoc.com/presentation_image/0ec26d9fc27a2435c769b5e426ac969d/image-61.jpg)
![](https://slidetodoc.com/presentation_image/0ec26d9fc27a2435c769b5e426ac969d/image-62.jpg)
![](https://slidetodoc.com/presentation_image/0ec26d9fc27a2435c769b5e426ac969d/image-63.jpg)
![ベクトルの内積 ; ; product: list -> number ; ; inner product of two vectors ベクトルの内積 ; ; product: list -> number ; ; inner product of two vectors](https://slidetodoc.com/presentation_image/0ec26d9fc27a2435c769b5e426ac969d/image-64.jpg)
![No (empty? x) Yes (+ (* (first x) (first y)) (product (rest x) (rest No (empty? x) Yes (+ (* (first x) (first y)) (product (rest x) (rest](https://slidetodoc.com/presentation_image/0ec26d9fc27a2435c769b5e426ac969d/image-65.jpg)
![ベクトルの内積 product • product の内部に product が登場 (define (product x y) (cond [(empty? x) ベクトルの内積 product • product の内部に product が登場 (define (product x y) (cond [(empty? x)](https://slidetodoc.com/presentation_image/0ec26d9fc27a2435c769b5e426ac969d/image-66.jpg)
![](https://slidetodoc.com/presentation_image/0ec26d9fc27a2435c769b5e426ac969d/image-67.jpg)
![](https://slidetodoc.com/presentation_image/0ec26d9fc27a2435c769b5e426ac969d/image-68.jpg)
![(product (list 1 2 3) (list 4 5 6)) から 32 が得られる過程の概略 最初の式 (product (product (list 1 2 3) (list 4 5 6)) から 32 が得られる過程の概略 最初の式 (product](https://slidetodoc.com/presentation_image/0ec26d9fc27a2435c769b5e426ac969d/image-69.jpg)
![(product (list 1 2 3) (list 4 5 6)) から (+ 4 (product (list (product (list 1 2 3) (list 4 5 6)) から (+ 4 (product (list](https://slidetodoc.com/presentation_image/0ec26d9fc27a2435c769b5e426ac969d/image-70.jpg)
![(product (list 1 2 3) (list 4 5 6)) から (+ 4 (product (list (product (list 1 2 3) (list 4 5 6)) から (+ 4 (product (list](https://slidetodoc.com/presentation_image/0ec26d9fc27a2435c769b5e426ac969d/image-71.jpg)
![](https://slidetodoc.com/presentation_image/0ec26d9fc27a2435c769b5e426ac969d/image-72.jpg)
![](https://slidetodoc.com/presentation_image/0ec26d9fc27a2435c769b5e426ac969d/image-73.jpg)
![](https://slidetodoc.com/presentation_image/0ec26d9fc27a2435c769b5e426ac969d/image-74.jpg)
![](https://slidetodoc.com/presentation_image/0ec26d9fc27a2435c769b5e426ac969d/image-75.jpg)
![](https://slidetodoc.com/presentation_image/0ec26d9fc27a2435c769b5e426ac969d/image-76.jpg)
![](https://slidetodoc.com/presentation_image/0ec26d9fc27a2435c769b5e426ac969d/image-77.jpg)
![](https://slidetodoc.com/presentation_image/0ec26d9fc27a2435c769b5e426ac969d/image-78.jpg)
![](https://slidetodoc.com/presentation_image/0ec26d9fc27a2435c769b5e426ac969d/image-79.jpg)
![](https://slidetodoc.com/presentation_image/0ec26d9fc27a2435c769b5e426ac969d/image-80.jpg)
![](https://slidetodoc.com/presentation_image/0ec26d9fc27a2435c769b5e426ac969d/image-81.jpg)
![](https://slidetodoc.com/presentation_image/0ec26d9fc27a2435c769b5e426ac969d/image-82.jpg)
![](https://slidetodoc.com/presentation_image/0ec26d9fc27a2435c769b5e426ac969d/image-83.jpg)
![](https://slidetodoc.com/presentation_image/0ec26d9fc27a2435c769b5e426ac969d/image-84.jpg)
![](https://slidetodoc.com/presentation_image/0ec26d9fc27a2435c769b5e426ac969d/image-85.jpg)
![入力と出力 (list 11 12 13 14) 1 my-list-ref 入力 12 出力 86 入力と出力 (list 11 12 13 14) 1 my-list-ref 入力 12 出力 86](https://slidetodoc.com/presentation_image/0ec26d9fc27a2435c769b5e426ac969d/image-86.jpg)
![](https://slidetodoc.com/presentation_image/0ec26d9fc27a2435c769b5e426ac969d/image-87.jpg)
![(my-list-ref (list 11 12 13 14) 1) から12が得られる過程 (my-list-ref (list 11 12 13 14) (my-list-ref (list 11 12 13 14) 1) から12が得られる過程 (my-list-ref (list 11 12 13 14)](https://slidetodoc.com/presentation_image/0ec26d9fc27a2435c769b5e426ac969d/image-88.jpg)
![(my-list-ref (list 11 12 13 14) 1) から12が得られる過程 (my-list-ref (list 11 12 13 14) (my-list-ref (list 11 12 13 14) 1) から12が得られる過程 (my-list-ref (list 11 12 13 14)](https://slidetodoc.com/presentation_image/0ec26d9fc27a2435c769b5e426ac969d/image-89.jpg)
![](https://slidetodoc.com/presentation_image/0ec26d9fc27a2435c769b5e426ac969d/image-90.jpg)
![](https://slidetodoc.com/presentation_image/0ec26d9fc27a2435c769b5e426ac969d/image-91.jpg)
![](https://slidetodoc.com/presentation_image/0ec26d9fc27a2435c769b5e426ac969d/image-92.jpg)
![](https://slidetodoc.com/presentation_image/0ec26d9fc27a2435c769b5e426ac969d/image-93.jpg)
![「(rest (list 11 12 13 14))」は 「(list 12 13 14)」で置き換わる 94 「(rest (list 11 12 13 14))」は 「(list 12 13 14)」で置き換わる 94](https://slidetodoc.com/presentation_image/0ec26d9fc27a2435c769b5e426ac969d/image-94.jpg)
![](https://slidetodoc.com/presentation_image/0ec26d9fc27a2435c769b5e426ac969d/image-95.jpg)
![](https://slidetodoc.com/presentation_image/0ec26d9fc27a2435c769b5e426ac969d/image-96.jpg)
![](https://slidetodoc.com/presentation_image/0ec26d9fc27a2435c769b5e426ac969d/image-97.jpg)
![](https://slidetodoc.com/presentation_image/0ec26d9fc27a2435c769b5e426ac969d/image-98.jpg)
![](https://slidetodoc.com/presentation_image/0ec26d9fc27a2435c769b5e426ac969d/image-99.jpg)
![](https://slidetodoc.com/presentation_image/0ec26d9fc27a2435c769b5e426ac969d/image-100.jpg)
![](https://slidetodoc.com/presentation_image/0ec26d9fc27a2435c769b5e426ac969d/image-101.jpg)
![リストの n 番目の要素 (define (my-list-ref a-list n) (cond 終了 [(= n 0) (first a-list)] リストの n 番目の要素 (define (my-list-ref a-list n) (cond 終了 [(= n 0) (first a-list)]](https://slidetodoc.com/presentation_image/0ec26d9fc27a2435c769b5e426ac969d/image-102.jpg)
![(= n 0) No Yes (my-list-ref (rest a-list) (- n 1)) (first a-list) が自明な解である (= n 0) No Yes (my-list-ref (rest a-list) (- n 1)) (first a-list) が自明な解である](https://slidetodoc.com/presentation_image/0ec26d9fc27a2435c769b5e426ac969d/image-103.jpg)
![リストの n 番目の要素 my-list-ref • my-list-ref の内部に my-list-ref が登場 (define (my-list-ref a-list n) (cond リストの n 番目の要素 my-list-ref • my-list-ref の内部に my-list-ref が登場 (define (my-list-ref a-list n) (cond](https://slidetodoc.com/presentation_image/0ec26d9fc27a2435c769b5e426ac969d/image-104.jpg)
![](https://slidetodoc.com/presentation_image/0ec26d9fc27a2435c769b5e426ac969d/image-105.jpg)
![](https://slidetodoc.com/presentation_image/0ec26d9fc27a2435c769b5e426ac969d/image-106.jpg)
![](https://slidetodoc.com/presentation_image/0ec26d9fc27a2435c769b5e426ac969d/image-107.jpg)
![入力と出力 2 (list 11 12) my-length 入力 出力 108 入力と出力 2 (list 11 12) my-length 入力 出力 108](https://slidetodoc.com/presentation_image/0ec26d9fc27a2435c769b5e426ac969d/image-108.jpg)
![](https://slidetodoc.com/presentation_image/0ec26d9fc27a2435c769b5e426ac969d/image-109.jpg)
![(my-list-ref (list 11 12)) から 2 が得られる過程 (1/2) (my-length (list 11 12)) 最初の式 = (my-list-ref (list 11 12)) から 2 が得られる過程 (1/2) (my-length (list 11 12)) 最初の式 =](https://slidetodoc.com/presentation_image/0ec26d9fc27a2435c769b5e426ac969d/image-110.jpg)
![(my-list-ref (list 11 12)) から 2 が得られる過程 (2/2) = (+ 1 (my-length (rest (list (my-list-ref (list 11 12)) から 2 が得られる過程 (2/2) = (+ 1 (my-length (rest (list](https://slidetodoc.com/presentation_image/0ec26d9fc27a2435c769b5e426ac969d/image-111.jpg)
![](https://slidetodoc.com/presentation_image/0ec26d9fc27a2435c769b5e426ac969d/image-112.jpg)
![](https://slidetodoc.com/presentation_image/0ec26d9fc27a2435c769b5e426ac969d/image-113.jpg)
![](https://slidetodoc.com/presentation_image/0ec26d9fc27a2435c769b5e426ac969d/image-114.jpg)
![](https://slidetodoc.com/presentation_image/0ec26d9fc27a2435c769b5e426ac969d/image-115.jpg)
![](https://slidetodoc.com/presentation_image/0ec26d9fc27a2435c769b5e426ac969d/image-116.jpg)
![リストの長さ (define (my-length a-list) (cond 終了条件 [(empty? a-list) 0] 自明な解 [else (+ 1 (my-length リストの長さ (define (my-length a-list) (cond 終了条件 [(empty? a-list) 0] 自明な解 [else (+ 1 (my-length](https://slidetodoc.com/presentation_image/0ec26d9fc27a2435c769b5e426ac969d/image-117.jpg)
![No (empty? a-list) Yes (+ 1 (my-length (rest a-list))) 0 が自明な解である 118 No (empty? a-list) Yes (+ 1 (my-length (rest a-list))) 0 が自明な解である 118](https://slidetodoc.com/presentation_image/0ec26d9fc27a2435c769b5e426ac969d/image-118.jpg)
![リストの長さ my-length • my-length の内部に my-length が登場 (define (my-length a-list) (cond [(empty? a-list) 0] リストの長さ my-length • my-length の内部に my-length が登場 (define (my-length a-list) (cond [(empty? a-list) 0]](https://slidetodoc.com/presentation_image/0ec26d9fc27a2435c769b5e426ac969d/image-119.jpg)
- Slides: 119
![](https://slidetodoc.com/presentation_image/0ec26d9fc27a2435c769b5e426ac969d/image-1.jpg)
![](https://slidetodoc.com/presentation_image/0ec26d9fc27a2435c769b5e426ac969d/image-2.jpg)
![](https://slidetodoc.com/presentation_image/0ec26d9fc27a2435c769b5e426ac969d/image-3.jpg)
![](https://slidetodoc.com/presentation_image/0ec26d9fc27a2435c769b5e426ac969d/image-4.jpg)
![](https://slidetodoc.com/presentation_image/0ec26d9fc27a2435c769b5e426ac969d/image-5.jpg)
![](https://slidetodoc.com/presentation_image/0ec26d9fc27a2435c769b5e426ac969d/image-6.jpg)
![](https://slidetodoc.com/presentation_image/0ec26d9fc27a2435c769b5e426ac969d/image-7.jpg)
![](https://slidetodoc.com/presentation_image/0ec26d9fc27a2435c769b5e426ac969d/image-8.jpg)
![](https://slidetodoc.com/presentation_image/0ec26d9fc27a2435c769b5e426ac969d/image-9.jpg)
![Dr Scheme の使用 Dr Scheme の起動 プログラム PLT Scheme Dr Scheme Dr. Scheme の使用 • Dr. Scheme の起動 プログラム → PLT Scheme → Dr. Scheme •](https://slidetodoc.com/presentation_image/0ec26d9fc27a2435c769b5e426ac969d/image-10.jpg)
Dr. Scheme の使用 • Dr. Scheme の起動 プログラム → PLT Scheme → Dr. Scheme • 今日の演習では「Intermediate Student」 に設定 Language → Choose Language → Intermediate Student → Execute ボタン 10
![](https://slidetodoc.com/presentation_image/0ec26d9fc27a2435c769b5e426ac969d/image-11.jpg)
![](https://slidetodoc.com/presentation_image/0ec26d9fc27a2435c769b5e426ac969d/image-12.jpg)
![](https://slidetodoc.com/presentation_image/0ec26d9fc27a2435c769b5e426ac969d/image-13.jpg)
![](https://slidetodoc.com/presentation_image/0ec26d9fc27a2435c769b5e426ac969d/image-14.jpg)
![](https://slidetodoc.com/presentation_image/0ec26d9fc27a2435c769b5e426ac969d/image-15.jpg)
![](https://slidetodoc.com/presentation_image/0ec26d9fc27a2435c769b5e426ac969d/image-16.jpg)
![](https://slidetodoc.com/presentation_image/0ec26d9fc27a2435c769b5e426ac969d/image-17.jpg)
![](https://slidetodoc.com/presentation_image/0ec26d9fc27a2435c769b5e426ac969d/image-18.jpg)
![リストの総和 define listsum alist cond 終了条件 empty alist 0自明な解 else first alist listsum リストの総和 (define (list-sum a-list) (cond 終了条件 [(empty? a-list) 0]自明な解 [else (+ (first a-list) (list-sum](https://slidetodoc.com/presentation_image/0ec26d9fc27a2435c769b5e426ac969d/image-19.jpg)
リストの総和 (define (list-sum a-list) (cond 終了条件 [(empty? a-list) 0]自明な解 [else (+ (first a-list) (list-sum (rest alist)))])) 19
![No empty alist Yes first alist listsum rest alist 0 が自明な解である 20 No (empty? a-list) Yes (+ (first a-list) (list-sum (rest a-list))) 0 が自明な解である 20](https://slidetodoc.com/presentation_image/0ec26d9fc27a2435c769b5e426ac969d/image-20.jpg)
No (empty? a-list) Yes (+ (first a-list) (list-sum (rest a-list))) 0 が自明な解である 20
![リストの総和 listsum listsum の内部に listsum が登場 define listsum alist cond empty alist 0 リストの総和 list-sum • list-sum の内部に list-sum が登場 (define (list-sum a-list) (cond [(empty? a-list) 0]](https://slidetodoc.com/presentation_image/0ec26d9fc27a2435c769b5e426ac969d/image-21.jpg)
リストの総和 list-sum • list-sum の内部に list-sum が登場 (define (list-sum a-list) (cond [(empty? a-list) 0] [else (+ (first a-list) (list-sum (rest a-list)))])) • sum の実行が繰り返される 例: (list-sum (list 1 2 3)) = (+ 1 (list-sum (list 2 3))) 21
![](https://slidetodoc.com/presentation_image/0ec26d9fc27a2435c769b5e426ac969d/image-22.jpg)
![](https://slidetodoc.com/presentation_image/0ec26d9fc27a2435c769b5e426ac969d/image-23.jpg)
![](https://slidetodoc.com/presentation_image/0ec26d9fc27a2435c769b5e426ac969d/image-24.jpg)
![listsum list 1 2 3 から 1 list 2 3 が得られる過程 listsum list (list-sum (list 1 2 3)) から (+ 1 (list 2 3)) が得られる過程 (list-sum (list](https://slidetodoc.com/presentation_image/0ec26d9fc27a2435c769b5e426ac969d/image-25.jpg)
(list-sum (list 1 2 3)) から (+ 1 (list 2 3)) が得られる過程 (list-sum (list 1 2 3)) = (cond =. . . [(empty? (list 1 2 3)) 0] [else (+ (first (list 1 2 3)) = (+ 1 (list-sum (list 2 3))) (list-sum (rest (list 1 2 3))))]) この部分は =. . . = (cond = (+ 1 (+ 2 (list-sum (list 3)))) [false 0] [else (+ (first (list 1 2 3)) =. . . (list-sum (rest (list 1 2 3))))]) = (+ (first (list 1 2 3)) = (+ 1 (+ 2 (+ 3 (list-sum empty)))) (list-sum (rest (list 1 2 3)))) =. . . = (+ 1 (list-sum (rest (list 1 2 3)))) = (+ 1 (+ 2 (+ 3 0))) = (+ 1 (list-sum (list 2 3))) = (+ 1 (+ 2 3)) = (+ 1 5) =6 25
![listsum list 1 2 3 から 1 list 2 3 が得られる過程 listsum list (list-sum (list 1 2 3)) から (+ 1 (list 2 3)) が得られる過程 (list-sum (list](https://slidetodoc.com/presentation_image/0ec26d9fc27a2435c769b5e426ac969d/image-26.jpg)
(list-sum (list 1 2 3)) から (+ 1 (list 2 3)) が得られる過程 (list-sum (list 1 2 3)) = (cond =. . . [(empty? (list 1 2 3)) 0] [else (+ (first (list 1 2 3)) = (+ 1 (list-sum (list 2 3))) (list-sum (rest (list 1 2 3))))]) この部分は =. . . = (cond = (+ 1 (+ 2 (list-sum (list 3)))) [false 0] [else (+ (first (list 1 2 3)) =. . . (list-sum (rest (list 1 2 3))))]) = (+ (first (list 1 2 3)) = (+これは, 1 (+ 2 (+ 3 (list-sum empty)))) (list-sum (rest (list 1 2 3)))) =. . . (define (sum a-list) = (+ 1 (cond (list-sum (rest (list 1 2 3)))) = (+ 1 (+ [(empty? 2 (+ 3 0))) a-list) 0] = (+ 1 (list-sum (list 2 3))) = (+ 1 (+ [else 2 3))(+ (first a-list) (sum (rest a-list)))])) = (+ 1 5) の a-list を (list 1 2 3) で置き換えたもの =6 26
![contains5 list 3 5 7 9 から contains5 list 5 7 9が得られる過程 list 3 (contains-5? (list 3 5 7 9)) から (contains-5? (list 5 7 9))が得られる過程 (list 3](https://slidetodoc.com/presentation_image/0ec26d9fc27a2435c769b5e426ac969d/image-27.jpg)
(contains-5? (list 3 5 7 9)) から (contains-5? (list 5 7 9))が得られる過程 (list 3 5 7 9)) (contains-5? (list 3 5 7 9))(contains-5? = (cond [(empty? (list 3 5 7 9)) false] [else (cond =… この部分は [(= (first (list 3 5 7 9)) 5) true] [else (contains-5? (rest (list 3 5 7 9)))])]) =(contains-5? (list 5 7 9)) = (cond [false] =… [else (cond [(= (first (list 3 5 7 9)) 5) true] [else (contains-5? (rest (list 3 5 7 9)))])]) = これは, true = (cond (define (contains-5? a-list) [(= (first (list 3 5 7 9)) 5) true] [else (contains-5? (rest (list 3 5 7 9)))]) (cond = (cond [(empty? a-list) false] [(= 3 5) true] [else (contains-5? (rest (list 3 5 7 9)))]) [else (cond = (cond [(= (first a-list) 5) true] [false true] [else (contains-5? (rest (list 3 5 7 9)))]) [else (contains-5? (rest a-list))])])) = (contains-5? (rest (list 3 5 7 9))) の a-list を (list 3 5 7 9) で置き換えたもの = (contains-5? (list 5 7 9)) 27
![](https://slidetodoc.com/presentation_image/0ec26d9fc27a2435c769b5e426ac969d/image-28.jpg)
![](https://slidetodoc.com/presentation_image/0ec26d9fc27a2435c769b5e426ac969d/image-29.jpg)
![例題3平均点の手順 1 次を定義用ウインドウで実行しなさい 入力した後にExecute ボタンを押す listsum list number 「例題3.平均点」の手順 1. 次を「定義用ウインドウ」で,実行しなさい • 入力した後に,Execute ボタンを押す ; ; list-sum: list -> number ; ;](https://slidetodoc.com/presentation_image/0ec26d9fc27a2435c769b5e426ac969d/image-30.jpg)
「例題3.平均点」の手順 1. 次を「定義用ウインドウ」で,実行しなさい • 入力した後に,Execute ボタンを押す ; ; list-sum: list -> number ; ; total of a list ; ; (list-sum (list 40 90 80)) = 210 (define (list-sum a-list) (cond [(empty? a-list) 0] [else (+ (first a-list) (list-sum (rest a-list)))])) ; ; average: list -> number ; ; average of a list ; ; (average (list 40 90 80)) = 70 (define (average a-list) (/ (list-sum a-list) (length a-list))) 2. その後,次を「実行用ウインドウ」で実行しなさい (average (list 40 90 80)) (average (list 100 200 300 400 500)) ☆ 次は,例題4に進んでください 30
![](https://slidetodoc.com/presentation_image/0ec26d9fc27a2435c769b5e426ac969d/image-31.jpg)
![](https://slidetodoc.com/presentation_image/0ec26d9fc27a2435c769b5e426ac969d/image-32.jpg)
![](https://slidetodoc.com/presentation_image/0ec26d9fc27a2435c769b5e426ac969d/image-33.jpg)
![平均点のプログラム listsum list number total of a list 平均点のプログラム ; ; list-sum: list -> number ; ; total of a list ;](https://slidetodoc.com/presentation_image/0ec26d9fc27a2435c769b5e426ac969d/image-34.jpg)
平均点のプログラム ; ; list-sum: list -> number ; ; total of a list ; ; (list-sum (list 40 90 80)) = 210 (define (list-sum a-list) (cond [(empty? a-list) 0] [else (+ (first a-list) (list-sum (rest a-list)))])) ; ; average: list -> number ; ; average of a list ; ; (average (list 40 90 80)) = 70 (define (average a-list) (/ (list-sum a-list) (length a-list))) list-sum の部分 average の部分 34
![](https://slidetodoc.com/presentation_image/0ec26d9fc27a2435c769b5e426ac969d/image-35.jpg)
![](https://slidetodoc.com/presentation_image/0ec26d9fc27a2435c769b5e426ac969d/image-36.jpg)
![例題4ステップ実行の手順 1 次を定義用ウインドウで実行しなさい Intermediate Student で実行すること 入力した後にExecute ボタンを押す listsum list 「例題4.ステップ実行」の手順 1. 次を「定義用ウインドウ」で,実行しなさい • Intermediate Student で実行すること • 入力した後に,Execute ボタンを押す ; ; list-sum: list](https://slidetodoc.com/presentation_image/0ec26d9fc27a2435c769b5e426ac969d/image-37.jpg)
「例題4.ステップ実行」の手順 1. 次を「定義用ウインドウ」で,実行しなさい • Intermediate Student で実行すること • 入力した後に,Execute ボタンを押す ; ; list-sum: list -> number ; ; total of a list ; ; (list-sum (list 40 90 80)) = 210 (define (list-sum a-list) (cond [(empty? a-list) 0] [else (+ (first a-list) (list-sum (rest a-list)))])) ; ; average: list -> number ; ; average of a list ; ; (average (list 40 90 80)) = 70 (define (average a-list) (/ (list-sum a-list) (length a-list))) (list-sum (list 40 90 80)) 例題3と同じ 2. Dr. Scheme を使って,ステップ実行の様子を 確認しなさい (Step ボタン,Next ボタンを使用) • 理解しながら進むこと ☆ 次は,例題5に進んでください 37
![average list 40 90 80 から 70 が得られる過程の概略 average list 40 90 80最初の式 (average (list 40 90 80)) から 70 が得られる過程の概略 (average (list 40 90 80))最初の式 =](https://slidetodoc.com/presentation_image/0ec26d9fc27a2435c769b5e426ac969d/image-38.jpg)
(average (list 40 90 80)) から 70 が得られる過程の概略 (average (list 40 90 80))最初の式 = (/ (list-sum (list 40 90 80)) (length (list 40 90 80))) =… = (/ 210 (length (list 40 90 80))) =. . . = (/ 210 3) コンピュータ内部での計算 = 70 実行結果 38
![average list 40 90 80 から 70 が得られる過程の概略 average list 40 90 80 (average (list 40 90 80)) から 70 が得られる過程の概略 (average (list 40 90 80)) =](https://slidetodoc.com/presentation_image/0ec26d9fc27a2435c769b5e426ac969d/image-39.jpg)
(average (list 40 90 80)) から 70 が得られる過程の概略 (average (list 40 90 80)) = (/ (list-sum (list 40 90 80)) (length (list 40 90 80))) =… = (/ 210 (length (list 40 90 80))) これは, =. . . (define (average a-list) = (/ 210(/3)(list-sum a-list) (length a-list))) = 70 の a-list を (list 40 90 80) で置き換えたもの 39
![](https://slidetodoc.com/presentation_image/0ec26d9fc27a2435c769b5e426ac969d/image-40.jpg)
![例題55を含むか調べるの手順 1 次を定義用ウインドウで実行しなさい 入力した後にExecute ボタンを押す contains5 list true or 「例題5.「5」を含むか調べる」の手順 1. 次を「定義用ウインドウ」で,実行しなさい • 入力した後に,Execute ボタンを押す ; ; contains-5? : list -> true or](https://slidetodoc.com/presentation_image/0ec26d9fc27a2435c769b5e426ac969d/image-41.jpg)
「例題5.「5」を含むか調べる」の手順 1. 次を「定義用ウインドウ」で,実行しなさい • 入力した後に,Execute ボタンを押す ; ; contains-5? : list -> true or false ; ; it investigates whether 5 is included ; ; (contains-5? (list 3 5 7 9)) = true (define (contains-5? a-list) (cond [(empty? a-list) false] [else (cond [(= (first a-list) 5) true] [else (contains-5? (rest a-list))])])) 2. その後,次を「実行用ウインドウ」で実行しなさい (contains-5? (list 1 2 3 4)) (contains-5? (list 3 5 7 9)) ☆ 次は,例題6に進んでください 41
![](https://slidetodoc.com/presentation_image/0ec26d9fc27a2435c769b5e426ac969d/image-42.jpg)
![](https://slidetodoc.com/presentation_image/0ec26d9fc27a2435c769b5e426ac969d/image-43.jpg)
![](https://slidetodoc.com/presentation_image/0ec26d9fc27a2435c769b5e426ac969d/image-44.jpg)
![contains5 関数 contains5 list true or false it contains-5? 関数 ; ; contains-5? : list -> true or false ; ; it](https://slidetodoc.com/presentation_image/0ec26d9fc27a2435c769b5e426ac969d/image-45.jpg)
contains-5? 関数 ; ; contains-5? : list -> true or false ; ; it investigates whether 5 is included ; ; (contains-5? (list 3 5 7 9)) = true (define (contains-5? a-list) (cond [(empty? a-list) false] [else (cond [(= (first a-list) 5) true] [else (contains-5? (rest a-list))])])) 45
![](https://slidetodoc.com/presentation_image/0ec26d9fc27a2435c769b5e426ac969d/image-46.jpg)
![](https://slidetodoc.com/presentation_image/0ec26d9fc27a2435c769b5e426ac969d/image-47.jpg)
![5を含むか調べる contains5 list true or false it investigates 「5」を含むか調べる ; ; contains-5? : list -> true or false ; ; it investigates](https://slidetodoc.com/presentation_image/0ec26d9fc27a2435c769b5e426ac969d/image-48.jpg)
「5」を含むか調べる ; ; contains-5? : list -> true or false ; ; it investigates whether 5 is included ; ; (contains-5? (list 3 5 7 9)) = true (define (contains-5? a-list) (cond 終了 [(empty? a-list) false] 自明な解 条件 [else (cond [(= (first a-list) 5) true] [else (contains-5? (rest a-list))])])) 48
![empty alist Yes No cond first alist 5 true else contains5 rest alist (empty? a-list) Yes No (cond [(= (first a-list) 5) true] [else (contains-5? (rest a-list))]](https://slidetodoc.com/presentation_image/0ec26d9fc27a2435c769b5e426ac969d/image-49.jpg)
(empty? a-list) Yes No (cond [(= (first a-list) 5) true] [else (contains-5? (rest a-list))] false が自明な解である 49
![5を含むか調べる contains5 contains5 の内部に contains5 が登場 define contains5 alist cond empty alist false 「5」を含むか調べる contains-5? • contains-5? の内部に contains-5? が登場 (define (contains-5? a-list) (cond [(empty? a-list) false]](https://slidetodoc.com/presentation_image/0ec26d9fc27a2435c769b5e426ac969d/image-50.jpg)
「5」を含むか調べる contains-5? • contains-5? の内部に contains-5? が登場 (define (contains-5? a-list) (cond [(empty? a-list) false] [else (cond [(= (first a-list) 5) true] [else (contains-5? (rest a-list))])])) • contains-5? の実行が繰り返される 例: (contains-5? (list 3 5 7 9)) = (contains-5? (list 5 7 9)) 50
![](https://slidetodoc.com/presentation_image/0ec26d9fc27a2435c769b5e426ac969d/image-51.jpg)
![](https://slidetodoc.com/presentation_image/0ec26d9fc27a2435c769b5e426ac969d/image-52.jpg)
![](https://slidetodoc.com/presentation_image/0ec26d9fc27a2435c769b5e426ac969d/image-53.jpg)
![contains5 list 3 5 7 9 から contains5 list 5 7 9が得られる過程 list 3 (contains-5? (list 3 5 7 9)) から (contains-5? (list 5 7 9))が得られる過程 (list 3](https://slidetodoc.com/presentation_image/0ec26d9fc27a2435c769b5e426ac969d/image-54.jpg)
(contains-5? (list 3 5 7 9)) から (contains-5? (list 5 7 9))が得られる過程 (list 3 5 7 9)) (contains-5? (list 3 5 7 9))(contains-5? = (cond =… =(contains-5? (list =… = true [(empty? (list 3 5 7 9)) false] [else (cond この部分は [(= (first (list 3 5 7 9)) 5) true] [else (contains-5? (rest (list 3 5 7 9)))])]) 5 7 9)) = (cond [false] [else (cond [(= (first (list 3 5 7 9)) 5) true] [else (contains-5? (rest (list 3 5 7 9)))])]) = (cond [(= (first (list 3 5 7 9)) 5) true] [else (contains-5? (rest (list 3 5 7 9)))]) = (cond [(= 3 5) true] [else (contains-5? (rest (list 3 5 7 9)))]) = (cond [false true] [else (contains-5? (rest (list 3 5 7 9)))]) = (contains-5? (rest (list 3 5 7 9))) = (contains-5? (list 5 7 9)) 54
![contains5 list 3 5 7 9 から contains5 list 5 7 9が得られる過程 list 3 (contains-5? (list 3 5 7 9)) から (contains-5? (list 5 7 9))が得られる過程 (list 3](https://slidetodoc.com/presentation_image/0ec26d9fc27a2435c769b5e426ac969d/image-55.jpg)
(contains-5? (list 3 5 7 9)) から (contains-5? (list 5 7 9))が得られる過程 (list 3 5 7 9)) (contains-5? (list 3 5 7 9))(contains-5? = (cond [(empty? (list 3 5 7 9)) false] [else (cond =… この部分は [(= (first (list 3 5 7 9)) 5) true] [else (contains-5? (rest (list 3 5 7 9)))])]) =(contains-5? (list 5 7 9)) = (cond [false] =… [else (cond [(= (first (list 3 5 7 9)) 5) true] [else (contains-5? (rest (list 3 5 7 9)))])]) = これは, true = (cond (define (contains-5? a-list) [(= (first (list 3 5 7 9)) 5) true] [else (contains-5? (rest (list 3 5 7 9)))]) (cond = (cond [(empty? a-list) false] [(= 3 5) true] [else (contains-5? (rest (list 3 5 7 9)))]) [else (cond = (cond [(= (first a-list) 5) true] [false true] [else (contains-5? (rest (list 3 5 7 9)))]) [else (contains-5? (rest a-list))])])) = (contains-5? (rest (list 3 5 7 9))) の a-list を (list 3 5 7 9) で置き換えたもの = (contains-5? (list 5 7 9)) 55
![](https://slidetodoc.com/presentation_image/0ec26d9fc27a2435c769b5e426ac969d/image-56.jpg)
![](https://slidetodoc.com/presentation_image/0ec26d9fc27a2435c769b5e426ac969d/image-57.jpg)
![](https://slidetodoc.com/presentation_image/0ec26d9fc27a2435c769b5e426ac969d/image-58.jpg)
![](https://slidetodoc.com/presentation_image/0ec26d9fc27a2435c769b5e426ac969d/image-59.jpg)
![](https://slidetodoc.com/presentation_image/0ec26d9fc27a2435c769b5e426ac969d/image-60.jpg)
![product 関数 product list number inner product of two product 関数 ; ; product: list -> number ; ; inner product of two](https://slidetodoc.com/presentation_image/0ec26d9fc27a2435c769b5e426ac969d/image-61.jpg)
product 関数 ; ; product: list -> number ; ; inner product of two vectors ; ; (product (list 1 2 3) (list 4 5 6)) = 32 (define (product x y) (cond [(empty? x) 0] [else (+ (* (first x) (first y)) (product (rest x) (rest y)))])) 61
![](https://slidetodoc.com/presentation_image/0ec26d9fc27a2435c769b5e426ac969d/image-62.jpg)
![](https://slidetodoc.com/presentation_image/0ec26d9fc27a2435c769b5e426ac969d/image-63.jpg)
![ベクトルの内積 product list number inner product of two vectors ベクトルの内積 ; ; product: list -> number ; ; inner product of two vectors](https://slidetodoc.com/presentation_image/0ec26d9fc27a2435c769b5e426ac969d/image-64.jpg)
ベクトルの内積 ; ; product: list -> number ; ; inner product of two vectors ; ; (product (list 1 2 3) (list 4 5 6)) = 32 (define (product x y) 終了 条件 (cond [(empty? x) 0] 自明な解 [else (+ (* (first x) (first y)) (product (rest x) (rest y)))])) 64
![No empty x Yes first x first y product rest x rest No (empty? x) Yes (+ (* (first x) (first y)) (product (rest x) (rest](https://slidetodoc.com/presentation_image/0ec26d9fc27a2435c769b5e426ac969d/image-65.jpg)
No (empty? x) Yes (+ (* (first x) (first y)) (product (rest x) (rest y))) 0 が自明な解である 65
![ベクトルの内積 product product の内部に product が登場 define product x y cond empty x ベクトルの内積 product • product の内部に product が登場 (define (product x y) (cond [(empty? x)](https://slidetodoc.com/presentation_image/0ec26d9fc27a2435c769b5e426ac969d/image-66.jpg)
ベクトルの内積 product • product の内部に product が登場 (define (product x y) (cond [(empty? x) 0] [else (+ (* (first x) (first y)) (product (rest x) (rest y)))])) • product の実行が繰り返される 例: (product (list 1 2 3) (list 4 5 6)) = (+ (* 1 4) (product (list 2 3) (list 5 6))) 66
![](https://slidetodoc.com/presentation_image/0ec26d9fc27a2435c769b5e426ac969d/image-67.jpg)
![](https://slidetodoc.com/presentation_image/0ec26d9fc27a2435c769b5e426ac969d/image-68.jpg)
![product list 1 2 3 list 4 5 6 から 32 が得られる過程の概略 最初の式 product (product (list 1 2 3) (list 4 5 6)) から 32 が得られる過程の概略 最初の式 (product](https://slidetodoc.com/presentation_image/0ec26d9fc27a2435c769b5e426ac969d/image-69.jpg)
(product (list 1 2 3) (list 4 5 6)) から 32 が得られる過程の概略 最初の式 (product (list 1 2 3) (list 4 5 6)) =… = (+ (* 1 4) (product (list 2 3) (list 5 6))) =… = (+ 4 (+ 10 (product (list 3) (list 6)))) =… = (+ 4 (+ 10 (+ 18 (product empty)))) コンピュータ内部での計算 =… 実行結果 = 32 69
![product list 1 2 3 list 4 5 6 から 4 product list (product (list 1 2 3) (list 4 5 6)) から (+ 4 (product (list](https://slidetodoc.com/presentation_image/0ec26d9fc27a2435c769b5e426ac969d/image-70.jpg)
(product (list 1 2 3) (list 4 5 6)) から (+ 4 (product (list 2 3) (list 5 6))) が得られる過程 (product (list 1 2 3) (list 4 5 6)) = (cond (product (list 1 2 3) (list 4 5 6)) [(empty? (list 1 2 3)) 0] [else (+ (* (first (list 1 2 3)) (first (list 4 5 6))) =… (product (rest (list 1 2 3)) (rest (list 4 5 6))))]) この部分は = (cond = (+ 4 [false 0] (* (first (list 1 2 3)) (first (list 4 5 6))) (product (list 2 3) (list 5 6))) [else (+(product (rest (list 1 2 3)) (rest (list 4 5 6))))]) = (+ (* (first (list 1 2 3)) (first (list 4 5 6))) =… (product (rest (list 1 2 3)) (rest (list 4 5 6)))) = (+ (* 1 (first (list 4 5 6))) = (+ 4 (product (rest (list 1 2 3)) (rest (list 4 5 6)))) = (+ (* 1 4) (+ 10 (product (rest (list 1 2 3)) (rest (list 4 5 6)))) (product (list 3) (list 6)))) = (+ 4 (product (rest (list 1 2 3)) (rest (list 4 5 6)))) = (+ 4 (product (list 2 3) (rest (list 4 5 6)))) =… = (+ 4 (product (list 2 3) (list 5 6))) = (+ 4 (+ 10 (+ 18 (product empty)))) =… = 32 70
![product list 1 2 3 list 4 5 6 から 4 product list (product (list 1 2 3) (list 4 5 6)) から (+ 4 (product (list](https://slidetodoc.com/presentation_image/0ec26d9fc27a2435c769b5e426ac969d/image-71.jpg)
(product (list 1 2 3) (list 4 5 6)) から (+ 4 (product (list 2 3) (list 5 6))) が得られる過程 (product (list 1 2 3) (list 4 5 6)) = (cond (product (list 1 2 3) (list 4 5 6)) [(empty? (list 1 2 3)) 0] [else (+ (* (first (list 1 2 3)) (first (list 4 5 6))) =… (product (rest (list 1 2 3)) (rest (list 4 5 6))))]) この部分は = (cond = (+ 4 [false 0] (* (first (list 1 2 3)) (first (list 4 5 6))) (product (list 2 3) (list 5 6))) [else (+(product (rest (list 1 2 3)) (rest (list 4 5 6))))]) = (+ (* (first (list 1 2 3)) (first (list 4 5 6))) =… (product (rest (list 1 2 3)) (rest (list 4 5 6)))) これは, = (+ (* 1 (first (list 4 5 6))) = (+ 4 (product (rest (list 1 2 3)) (rest (list 4 5 6)))) (define (product x y) = (+ (* 1 4) (+ 10 (cond (product (rest (list 1 2 3)) (rest (list 4 5 6)))) (product (list 3) [(empty? x) (list 0] 6)))) = (+ 4 (product (rest (list 1 2 3)) (rest (list 4 5 6)))) = (+ 4 (product (list 2 3) (rest (list 4 5 6)))) [else (+ (* (first x) (first =… =y)) (+ 4 (product (list 2 3) (list 5 6))) (product (rest x) (rest y)))])) = (+ 4 (+ 10 (+ 18 (product empty)))) の x を (list 1 2 3) で,y を (list 4 5 6) で置き換えたもの =… = 32 71
![](https://slidetodoc.com/presentation_image/0ec26d9fc27a2435c769b5e426ac969d/image-72.jpg)
![](https://slidetodoc.com/presentation_image/0ec26d9fc27a2435c769b5e426ac969d/image-73.jpg)
![](https://slidetodoc.com/presentation_image/0ec26d9fc27a2435c769b5e426ac969d/image-74.jpg)
![](https://slidetodoc.com/presentation_image/0ec26d9fc27a2435c769b5e426ac969d/image-75.jpg)
![](https://slidetodoc.com/presentation_image/0ec26d9fc27a2435c769b5e426ac969d/image-76.jpg)
![](https://slidetodoc.com/presentation_image/0ec26d9fc27a2435c769b5e426ac969d/image-77.jpg)
![](https://slidetodoc.com/presentation_image/0ec26d9fc27a2435c769b5e426ac969d/image-78.jpg)
![](https://slidetodoc.com/presentation_image/0ec26d9fc27a2435c769b5e426ac969d/image-79.jpg)
![](https://slidetodoc.com/presentation_image/0ec26d9fc27a2435c769b5e426ac969d/image-80.jpg)
![](https://slidetodoc.com/presentation_image/0ec26d9fc27a2435c769b5e426ac969d/image-81.jpg)
![](https://slidetodoc.com/presentation_image/0ec26d9fc27a2435c769b5e426ac969d/image-82.jpg)
![](https://slidetodoc.com/presentation_image/0ec26d9fc27a2435c769b5e426ac969d/image-83.jpg)
![](https://slidetodoc.com/presentation_image/0ec26d9fc27a2435c769b5e426ac969d/image-84.jpg)
![](https://slidetodoc.com/presentation_image/0ec26d9fc27a2435c769b5e426ac969d/image-85.jpg)
![入力と出力 list 11 12 13 14 1 mylistref 入力 12 出力 86 入力と出力 (list 11 12 13 14) 1 my-list-ref 入力 12 出力 86](https://slidetodoc.com/presentation_image/0ec26d9fc27a2435c769b5e426ac969d/image-86.jpg)
入力と出力 (list 11 12 13 14) 1 my-list-ref 入力 12 出力 86
![](https://slidetodoc.com/presentation_image/0ec26d9fc27a2435c769b5e426ac969d/image-87.jpg)
![mylistref list 11 12 13 14 1 から12が得られる過程 mylistref list 11 12 13 14 (my-list-ref (list 11 12 13 14) 1) から12が得られる過程 (my-list-ref (list 11 12 13 14)](https://slidetodoc.com/presentation_image/0ec26d9fc27a2435c769b5e426ac969d/image-88.jpg)
(my-list-ref (list 11 12 13 14) 1) から12が得られる過程 (my-list-ref (list 11 12 13 14) 1) 最初の式 = (cond [(= 1 0) (first (list 11 12 13 14))] [else (my-list-ref (rest (list 11 12 13 14) ) (- 1 1))]) = (cond [false (first (list 11 12 13 14))] [else (my-list-ref (rest (list 11 12 13 14) ) (- 1 1))]) = (my-list-ref (rest (list 11 12 13 14) ) (- 1 1)) = (my-list-ref (list 12 13 14) 0) = (cond [(= 0 0) (first (list 12 13 14))] [else (my-list-ref (rest (list 12 13 14) ) (- 0 1))]) = (cond [true (first (list 12 13 14))] [else (my-list-ref (rest (list 12 13 14) ) (- 0 1))]) コンピュータ内部での計算 = (first (list 12 13 14)) 88 = 12 実行結果
![mylistref list 11 12 13 14 1 から12が得られる過程 mylistref list 11 12 13 14 (my-list-ref (list 11 12 13 14) 1) から12が得られる過程 (my-list-ref (list 11 12 13 14)](https://slidetodoc.com/presentation_image/0ec26d9fc27a2435c769b5e426ac969d/image-89.jpg)
(my-list-ref (list 11 12 13 14) 1) から12が得られる過程 (my-list-ref (list 11 12 13 14) 1) = (cond [(= 1 0) (first (list 11 12 13 14))] [else (my-list-ref (rest (list 11 12 13 14) ) (- 1 1))]) = (cond [false (first (list 11 12 13 14))] [else (my-list-ref (rest (list 11 12 13 14) ) (- 1 1))]) これは, = (my-list-ref (rest (list 11 12 13 14) ) (- 1 1)) (define(list (my-list-ref a-list = (my-list-ref 12 13 14) (1 1))n) = (my-list-ref (cond(list 12 13 14) 0) = (cond [(= n 0) (first a-list)] [(= 0 0) (first (list 12 13 14))] [else (my-list-ref 1))])) [else (my-list-ref (rest (list(rest 12 13 a-list) 14) ) (-(-0 n 1))]) a-list を (list 11 12 13 14) で,n を 1 で置き換えたも =の (cond の [true (first (list 12 13 14))] [else (my-list-ref (rest (list 12 13 14) ) (- 0 1))]) = (first (list 12 13 14)) 89 = 12
![](https://slidetodoc.com/presentation_image/0ec26d9fc27a2435c769b5e426ac969d/image-90.jpg)
![](https://slidetodoc.com/presentation_image/0ec26d9fc27a2435c769b5e426ac969d/image-91.jpg)
![](https://slidetodoc.com/presentation_image/0ec26d9fc27a2435c769b5e426ac969d/image-92.jpg)
![](https://slidetodoc.com/presentation_image/0ec26d9fc27a2435c769b5e426ac969d/image-93.jpg)
![rest list 11 12 13 14は list 12 13 14で置き換わる 94 「(rest (list 11 12 13 14))」は 「(list 12 13 14)」で置き換わる 94](https://slidetodoc.com/presentation_image/0ec26d9fc27a2435c769b5e426ac969d/image-94.jpg)
「(rest (list 11 12 13 14))」は 「(list 12 13 14)」で置き換わる 94
![](https://slidetodoc.com/presentation_image/0ec26d9fc27a2435c769b5e426ac969d/image-95.jpg)
![](https://slidetodoc.com/presentation_image/0ec26d9fc27a2435c769b5e426ac969d/image-96.jpg)
![](https://slidetodoc.com/presentation_image/0ec26d9fc27a2435c769b5e426ac969d/image-97.jpg)
![](https://slidetodoc.com/presentation_image/0ec26d9fc27a2435c769b5e426ac969d/image-98.jpg)
![](https://slidetodoc.com/presentation_image/0ec26d9fc27a2435c769b5e426ac969d/image-99.jpg)
![](https://slidetodoc.com/presentation_image/0ec26d9fc27a2435c769b5e426ac969d/image-100.jpg)
![](https://slidetodoc.com/presentation_image/0ec26d9fc27a2435c769b5e426ac969d/image-101.jpg)
![リストの n 番目の要素 define mylistref alist n cond 終了 n 0 first alist リストの n 番目の要素 (define (my-list-ref a-list n) (cond 終了 [(= n 0) (first a-list)]](https://slidetodoc.com/presentation_image/0ec26d9fc27a2435c769b5e426ac969d/image-102.jpg)
リストの n 番目の要素 (define (my-list-ref a-list n) (cond 終了 [(= n 0) (first a-list)] 自明な解 条件 [else (my-list-ref (rest a-list) (- n 1))])) 102
![n 0 No Yes mylistref rest alist n 1 first alist が自明な解である (= n 0) No Yes (my-list-ref (rest a-list) (- n 1)) (first a-list) が自明な解である](https://slidetodoc.com/presentation_image/0ec26d9fc27a2435c769b5e426ac969d/image-103.jpg)
(= n 0) No Yes (my-list-ref (rest a-list) (- n 1)) (first a-list) が自明な解である 103
![リストの n 番目の要素 mylistref mylistref の内部に mylistref が登場 define mylistref alist n cond リストの n 番目の要素 my-list-ref • my-list-ref の内部に my-list-ref が登場 (define (my-list-ref a-list n) (cond](https://slidetodoc.com/presentation_image/0ec26d9fc27a2435c769b5e426ac969d/image-104.jpg)
リストの n 番目の要素 my-list-ref • my-list-ref の内部に my-list-ref が登場 (define (my-list-ref a-list n) (cond [(= n 0) (first a-list)] [else (my-list-ref (rest a-list) (- n 1))])) • my-list-ref の実行が繰り返される 例: (my-list-ref (list 11 12 13 14) 1) = (my-list-ref (list 12 13 14) 0) 104
![](https://slidetodoc.com/presentation_image/0ec26d9fc27a2435c769b5e426ac969d/image-105.jpg)
![](https://slidetodoc.com/presentation_image/0ec26d9fc27a2435c769b5e426ac969d/image-106.jpg)
![](https://slidetodoc.com/presentation_image/0ec26d9fc27a2435c769b5e426ac969d/image-107.jpg)
![入力と出力 2 list 11 12 mylength 入力 出力 108 入力と出力 2 (list 11 12) my-length 入力 出力 108](https://slidetodoc.com/presentation_image/0ec26d9fc27a2435c769b5e426ac969d/image-108.jpg)
入力と出力 2 (list 11 12) my-length 入力 出力 108
![](https://slidetodoc.com/presentation_image/0ec26d9fc27a2435c769b5e426ac969d/image-109.jpg)
![mylistref list 11 12 から 2 が得られる過程 12 mylength list 11 12 最初の式 (my-list-ref (list 11 12)) から 2 が得られる過程 (1/2) (my-length (list 11 12)) 最初の式 =](https://slidetodoc.com/presentation_image/0ec26d9fc27a2435c769b5e426ac969d/image-110.jpg)
(my-list-ref (list 11 12)) から 2 が得られる過程 (1/2) (my-length (list 11 12)) 最初の式 = (cond [(empty? (list 11 12)) 0] [else (+ 1 (my-length (rest (list 11 12))))]) = (cond [false 0] [else (+ 1 (my-length (rest (list 11 12))))]) = (+ 1 (my-length (rest (list 11 12)))) = (+ 1 (my-length (list 12))) = (+ 1 (cond [(empty? (list 12)) 0] [else (+ 1 (my-length (rest (list 12))))])) = (+ 1 (cond [false 0] [else (+ 1 (my-length (rest (list 12))))])) コンピュータ内部での計算 110
![mylistref list 11 12 から 2 が得られる過程 22 1 mylength rest list (my-list-ref (list 11 12)) から 2 が得られる過程 (2/2) = (+ 1 (my-length (rest (list](https://slidetodoc.com/presentation_image/0ec26d9fc27a2435c769b5e426ac969d/image-111.jpg)
(my-list-ref (list 11 12)) から 2 が得られる過程 (2/2) = (+ 1 (my-length (rest (list 12))))) = (+ 1 (my-length empty))) = (+ 1 (cond [(empty? empty) 0] [else (+ 1 (my-length empty))])) = (+ 1 (cond [true 0] [else (+ 1 (my-length empty))])) = (+ 1 0)) コンピュータ内部での計算 = (+ 1 1) =2 実行結果 111
![](https://slidetodoc.com/presentation_image/0ec26d9fc27a2435c769b5e426ac969d/image-112.jpg)
![](https://slidetodoc.com/presentation_image/0ec26d9fc27a2435c769b5e426ac969d/image-113.jpg)
![](https://slidetodoc.com/presentation_image/0ec26d9fc27a2435c769b5e426ac969d/image-114.jpg)
![](https://slidetodoc.com/presentation_image/0ec26d9fc27a2435c769b5e426ac969d/image-115.jpg)
![](https://slidetodoc.com/presentation_image/0ec26d9fc27a2435c769b5e426ac969d/image-116.jpg)
![リストの長さ define mylength alist cond 終了条件 empty alist 0 自明な解 else 1 mylength リストの長さ (define (my-length a-list) (cond 終了条件 [(empty? a-list) 0] 自明な解 [else (+ 1 (my-length](https://slidetodoc.com/presentation_image/0ec26d9fc27a2435c769b5e426ac969d/image-117.jpg)
リストの長さ (define (my-length a-list) (cond 終了条件 [(empty? a-list) 0] 自明な解 [else (+ 1 (my-length (rest a-list)))])) 117
![No empty alist Yes 1 mylength rest alist 0 が自明な解である 118 No (empty? a-list) Yes (+ 1 (my-length (rest a-list))) 0 が自明な解である 118](https://slidetodoc.com/presentation_image/0ec26d9fc27a2435c769b5e426ac969d/image-118.jpg)
No (empty? a-list) Yes (+ 1 (my-length (rest a-list))) 0 が自明な解である 118
![リストの長さ mylength mylength の内部に mylength が登場 define mylength alist cond empty alist 0 リストの長さ my-length • my-length の内部に my-length が登場 (define (my-length a-list) (cond [(empty? a-list) 0]](https://slidetodoc.com/presentation_image/0ec26d9fc27a2435c769b5e426ac969d/image-119.jpg)
リストの長さ my-length • my-length の内部に my-length が登場 (define (my-length a-list) (cond [(empty? a-list) 0] [else (+ 1 (my-length (rest a-list)))])) • my-length の実行が繰り返される 例: (my-length (list 11 12)) = = (+ 1 (my-length (list 12))) 119
Plt scheme
Billy b and plt
What is considered high voltage
Lymphl
Engn plt
Anu mlp
Plt morphology
Plt fuzzy set
Independent enquirer
Fcps my plt
Plt histogram abn
Al culture
คืออะไร
Plt electronics
Plt skills
Plt cbc
Mdm hydra
Communication model
Import numpy as np import matplotlib.pyplot as plt
Plt 106
Kewenangan plt dan plh dalam aspek keuangan
Recognition of prior learning uts
Istogramma rbc
Pyramid scheme vs ponzi scheme
3 domain scheme and 5 kingdom scheme
Stata schemes
Nottingham private rented assistance scheme
Xe 133 decay
Hkie scheme a cpd
Examinations.ie marking scheme
No power of hell, no scheme of man bible verse
Ibm color scheme
End rhyme examples
Lgs protocols
Limericks origin
Rhyming scheme
Fors fleet operator recognition scheme
Sonnetdef
Semi direct lighting scheme
Stanza patterns
Schème maternelle
Sonetto 27 shakespeare
Mary had a little lamb rhyme scheme
Lean manufacturing competitiveness scheme
Scheme in python
National agriculture insurance scheme
Cesar scheme
Southampton district energy scheme
3 primary colors
Spelling scheme
Literary devices in not waving but drowning
Cas-croucher funding scheme for joint laboratories
Ofdm scheme
Nmdc pension scheme
The white man's burden rhyme scheme
Hash functions
Shakespeare
What is a rhyming scheme
O captain my captain line by line explanation
Ballade rhyme
Mood
Clumsy helmets
The lake isle of innisfree analysis
Here on the edge of hell stands harlem
A monster calls language paper 1 mark scheme
Field triage decision scheme
Life buddies mentoring scheme
Gcse photography keywords
The rhyme scheme for this is twinkle twinkle little star
Line color form
Sonnet 43
Trope used in a sentence
Indiareit fund scheme v
Quadratic color scheme
Scheme functional programming
We wear the mask structure
National colour coding scheme
Example of refrain
Zero deposit scheme pros and cons
Computer games teach us nothing
Classification scheme
He was born in 1827
Salsa scheme
Iambic pentameter
Slant rhyme
Shakespeare
Pararhyme in exposure
A devoted son comprehension marking scheme
Monash seas calculator
Vandemataram scheme
Formal informal invitation
Comp26120
Parish buying
Ripp scheme
Sonnet 130 explanation
Differential equations calculator
Color leadership test
Demonstrate rhyme
Arbitrary color scheme
Romeo and juliet.prologue
Eysenck’s two-dimensional scheme
Variable length subnetting
Classful addressing
What is a limerick example
Amrit ahluwalia
Fors lo city
Exact organization scheme
Warwick mentoring scheme
Stopping by woods on a snowy evening diction
Nrlm scheme
Key quotes for ozymandias
Ehtp scheme
Gell mann nishijima scheme
Aldi management programme
End rhyme
Means one color
Mats apprentice
How many elements of poetry are there
The incentive scheme that rules sumo is intricate
Pharmacy quality scheme