forked from DeathKing/Learning-SICP
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathlec9a.srt
6341 lines (5071 loc) · 131 KB
/
lec9a.srt
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
847
848
849
850
851
852
853
854
855
856
857
858
859
860
861
862
863
864
865
866
867
868
869
870
871
872
873
874
875
876
877
878
879
880
881
882
883
884
885
886
887
888
889
890
891
892
893
894
895
896
897
898
899
900
901
902
903
904
905
906
907
908
909
910
911
912
913
914
915
916
917
918
919
920
921
922
923
924
925
926
927
928
929
930
931
932
933
934
935
936
937
938
939
940
941
942
943
944
945
946
947
948
949
950
951
952
953
954
955
956
957
958
959
960
961
962
963
964
965
966
967
968
969
970
971
972
973
974
975
976
977
978
979
980
981
982
983
984
985
986
987
988
989
990
991
992
993
994
995
996
997
998
999
1000
1
00:00:00,032 --> 00:00:02,048
Learning-SICP学习小组
倾情制作
2
00:00:02,040 --> 00:00:06,160
翻译&&时间轴:邓雄飞
压制&&特效:邓雄飞(Dysprosium)
校对:邓雄飞(Dysprosium)
3
00:00:06,160 --> 00:00:08,160
特别感谢:裘宗燕教授
4
00:00:08,160 --> 00:00:12,032
计算机程序的构造和解释
5
00:00:12,032 --> 00:00:14,030
寄存机器
Register Machines
6
00:00:17,260 --> 00:00:19,072
教授:我认为 到目前为止
PROFESSOR: Well, up 'til now, I suppose,
7
00:00:19,328 --> 00:00:23,936
我们已经学习了很多关于
we've been learning about a lot of techniques for
8
00:00:24,096 --> 00:00:28,830
组织程序以及操纵符号的技术
organizing big programs, symbolic manipulation a bit,
9
00:00:30,848 --> 00:00:35,600
以及用来构建语言的技术
some of the technology that you use for establishing languages,
10
00:00:35,630 --> 00:00:36,784
用一门语言去创建另一门语言
one in terms of another,
11
00:00:37,104 --> 00:00:39,920
这在组织大型程序时非常有用
which is used for organizing very large programs.
12
00:00:39,968 --> 00:00:42,304
实际上 我所知的最好的程序
In fact, the nicest programs I know
13
00:00:42,448 --> 00:00:44,432
看起来更像是一堆语言
look more like a pile of languages
14
00:00:44,912 --> 00:00:47,968
而不是将问题分解成若干部分
than like a decomposition of a problem into parts.
15
00:00:49,900 --> 00:00:51,456
我想 此时此刻
Well, I suppose at this point,
16
00:00:52,080 --> 00:00:53,584
关于这类东西的工作方式
there are still, however, a few mysteries
17
00:00:53,616 --> 00:00:55,328
仍然存在一些谜团
about how this sort of stuff works.
18
00:00:56,260 --> 00:00:59,680
因此 我现在需要
And so what we'd like to do now is
19
00:01:00,030 --> 00:01:02,608
偏离原先的计划
diverge from the plan of
20
00:01:02,960 --> 00:01:05,420
不再继续讲解如何组织大型程序
telling you how to organize big programs,
21
00:01:05,450 --> 00:01:08,192
而是告诉你一些关于
and rather tell you something about the mechanisms
22
00:01:08,528 --> 00:01:11,710
使这些事情可以起作用的机制
by which these things can be made to work.
23
00:01:12,190 --> 00:01:14,832
这样做的主要是为了
The main reason for this is
24
00:01:15,808 --> 00:01:17,870
揭秘
demystification, if you will,
25
00:01:18,656 --> 00:01:20,540
剩下的很多谜团
that we have a lot of mysteries left,
26
00:01:21,080 --> 00:01:25,488
比如说 如何控制程序的运行
like exactly how it is the case that a program is controlled,
27
00:01:26,080 --> 00:01:30,384
计算机如何知晓下一步的动作
how a computer knows what the next thing to do is,
28
00:01:30,528 --> 00:01:31,744
等等等等
or something like that.
29
00:01:32,430 --> 00:01:35,568
我现在就要让你们清楚地知道
And what I'd like to do now is make that clear to you
30
00:01:35,856 --> 00:01:39,104
就算你之前没有使用过计算机
that even if you've never played with a physical computer before,
31
00:01:39,568 --> 00:01:43,504
但这种机制非常简单
the mechanism is really very simple,
32
00:01:44,336 --> 00:01:46,352
你可以毫无问题地理解它
and that you can understand it completely with no trouble.
33
00:01:47,650 --> 00:01:51,248
好吧 我们先来想象一个 --
So I'd like to start by imagining that we--
34
00:01:51,328 --> 00:01:52,912
先说明一下 我们采用的方法是
well, the way we're going to do this, by the way,
35
00:01:52,960 --> 00:01:55,808
把一些非常简单的Lisp程序
is we're going to take some very simple Lisp programs,
36
00:01:56,544 --> 00:01:58,128
真的非常简单
very simple Lisp programs,
37
00:01:59,040 --> 00:02:00,624
把它们转换成硬件
and transform them into hardware.
38
00:02:02,160 --> 00:02:04,160
我不会考虑一些中间步骤
I'm not going to worry about some intermediate step
39
00:02:04,700 --> 00:02:07,456
比如转换成某种现有的机器语言
of going through some existing computer machine language
40
00:02:07,472 --> 00:02:09,050
然后来解释计算机是如何工作的
and then showing you how that computer works,
41
00:02:09,824 --> 00:02:12,000
因为那不太明显
because that's not as illuminating.
42
00:02:12,750 --> 00:02:14,176
所以我真正要向你展示的是
So what I'm really going to show you
43
00:02:14,512 --> 00:02:17,488
如何构建一台机器来完成
is how a piece of machinery can be built
44
00:02:18,032 --> 00:02:22,040
一项由你写的程序所描述的工作
to do a job that you have written down as a program.
45
00:02:22,040 --> 00:02:24,032
而程序呢 实际上就是一个机器的描述
That program is, in fact, a description of a machine.
46
00:02:25,760 --> 00:02:27,696
我们从一个非常简单的程序开始
We're going to start with a very simple program,
47
00:02:28,096 --> 00:02:30,816
然后演示一些简单的机制
proceed to show you some simple mechanisms,
48
00:02:31,392 --> 00:02:33,680
进而用更复杂的程序
proceed to a few more complicated programs,
49
00:02:34,304 --> 00:02:37,420
然后又演示一个不那么复杂的程序
and then later show you a not very complicated program,
50
00:02:37,440 --> 00:02:41,230
来演示求值器是如何变成硬件的
how the evaluator transforms into a piece of hardware.
51
00:02:41,230 --> 00:02:42,064
当然 到那个时候
And of course at that point,
52
00:02:42,080 --> 00:02:44,080
你就有了通用的转换算法
you have made the universal transition
53
00:02:44,224 --> 00:02:46,880
并且可以用一个定义明确的硬件
and can execute any program imaginable
54
00:02:47,168 --> 00:02:48,800
来执行任何可以想象的程序
with a piece of well-defined hardware.
55
00:02:51,728 --> 00:02:52,912
那么 现在让我们开始
Well, let's start up now,
56
00:02:53,056 --> 00:02:55,312
给你们关于这些东西的具体感觉
give you a real concrete feeling for this sort of thing.
57
00:02:55,440 --> 00:02:57,664
我们先从一个非常简单的程序开始
Let's start with a very simple program.
58
00:02:59,600 --> 00:03:00,850
这是欧几里得算法
Here's Euclid's algorithm.
59
00:03:03,880 --> 00:03:07,008
它实际上比欧几里德算法更现代一些
It's actually a little bit more modern than Euclid's algorithm.
60
00:03:07,020 --> 00:03:10,096
我想 用来计算两数最大公约数的欧几里得算法
Euclid's algorithm for computing the greatest common divisor of two numbers
61
00:03:10,416 --> 00:03:13,600
是在公元前350年发明的
was invented 350 BC, I think.
62
00:03:14,300 --> 00:03:15,696
它是已知最古老的算法
It's the oldest known algorithm.
63
00:03:19,320 --> 00:03:23,344
我们先定义(GCD A B)
But here we're going to talk about GCD of A and B,
64
00:03:23,360 --> 00:03:25,616
也就是用来计算A、B两数的最大公约数
the Greatest Common Divisor or two numbers, A and B.
65
00:03:26,208 --> 00:03:28,912
这个算法相当简单
And the algorithm is extremely simple.
66
00:03:29,500 --> 00:03:31,088
如果B等于0
If B is 0,
67
00:03:34,160 --> 00:03:36,832
那么结果就是A
then the result is going to be A.
68
00:03:37,520 --> 00:03:43,616
否则结果就是 (GCD B
Otherwise, the result is the GCD of B
69
00:03:44,496 --> 00:03:53,392
(REMAINDER A B))
and the remainder when A is divided by B.
70
00:03:58,530 --> 00:04:01,904
这里 我们定义了一个简单的迭代过程
So this we have here is a very simple iterative process.
71
00:04:02,030 --> 00:04:04,080
这是一个简单的递归过程
This a simple recursive procedure,
72
00:04:04,380 --> 00:04:07,536
也可以说这个过程是递归地定义的
recursively defined procedure, recursive definition,
73
00:04:07,712 --> 00:04:09,264
但它产生的计算过程是迭代的
which yields an iterative process.
74
00:04:09,952 --> 00:04:12,460
它的原理是 在每一步
And the way it works is that every step,
75
00:04:12,800 --> 00:04:15,104
判断B是否为0
it determines whether B was zero.
76
00:04:16,240 --> 00:04:18,800
如果B为0 那么A的值就是我们的答案
And if B is 0, we got the answer in A.
77
00:04:19,632 --> 00:04:22,464
否则就进入下一个步骤
Otherwise, we make another step
78
00:04:22,496 --> 00:04:23,872
其中A就变成旧的B
where A is the old B,
79
00:04:23,888 --> 00:04:27,040
而B的值 是A旧值除B旧值的余数
and B is the remainder of the old A divided by the old B.
80
00:04:28,768 --> 00:04:29,552
非常简单
Very simple.
81
00:04:31,110 --> 00:04:32,720
现在 我已经通过这种方式
Now this, I've already told you
82
00:04:32,992 --> 00:04:34,860
告诉了你一些机制
some of the mechanism by just saying it that way.
83
00:04:34,860 --> 00:04:35,904
我是按时序告诉你们的
I said it in time.
84
00:04:36,360 --> 00:04:37,728
我说 其中有特定的步骤
I said there are certain steps,
85
00:04:38,144 --> 00:04:39,328
并且实际上
and that, in fact,
86
00:04:39,520 --> 00:04:40,864
你可以在这里知道
one of the things you can see here
87
00:04:41,184 --> 00:04:43,696
为什么这个过程是迭代的
is that one of the reasons why this is iterative
88
00:04:43,950 --> 00:04:47,680
是因为最后一步无需额外信息来得到答案
is nothing is needed of the last step to get the answer.
89
00:04:49,440 --> 00:04:55,290
所有运行此算法所需的信息都在A和B中
All of the information that's needed to run this algorithm is in A and B.
90
00:04:55,744 --> 00:04:57,808
它有两个定义明确的状态变量
It has two well-defined state variables.
91
00:05:00,470 --> 00:05:02,336
现在 我就要给你们定义一台机器
So I'm going to define a machine for you
92
00:05:03,984 --> 00:05:05,552
用来计算GCD
can compute you GCDs.
93
00:05:06,560 --> 00:05:07,120
我们来看看
Now let's see.
94
00:05:07,120 --> 00:05:11,280
每台制造的计算机都是单进程计算机
Every computer that's ever been made that's a single-process computer,
95
00:05:11,800 --> 00:05:14,080
而不是某种多处理器
as opposed to a multiprocessor of some sort,
96
00:05:15,040 --> 00:05:16,592
都是按照相同的方案制定的
is made according to the same plan.
97
00:05:17,840 --> 00:05:19,536
这种方案就是:计算机由两部分组成
The plan is the computer has two parts,
98
00:05:20,576 --> 00:05:22,352
一部分叫数据通路
a part called the datapaths,
99
00:05:23,104 --> 00:05:24,368
而另一部分叫控制器
and a part called the controller.
100
00:05:25,910 --> 00:05:29,280
数据通路相当于你可能有的计算器
The datapaths correspond to a calculator that you might have.
101
00:05:29,712 --> 00:05:31,872
它有一些寄存器 能够存储数据
It contains certain registers that remember things,
102
00:05:31,904 --> 00:05:33,136
你们都用过计算器
and you've all used calculators.
103
00:05:33,560 --> 00:05:35,344
它上面有一些按钮和指示灯
It has some buttons on it and some lights.
104
00:05:37,030 --> 00:05:38,496
通过按下不同的按钮
And so by pushing the various buttons,
105
00:05:38,528 --> 00:05:41,344
你可以使操作在寄存器内发生
you can cause operations to happen inside there among the registers,
106
00:05:41,872 --> 00:05:43,488
并显示计算结果
and some of the results to be displayed.
107
00:05:45,160 --> 00:05:46,250
它是完全机械式的
That's completely mechanical.
108
00:05:46,250 --> 00:05:49,552
你可以认为那个盒子没有任何智能
You could imagine that box has no intelligence in it.
109
00:05:50,900 --> 00:05:53,280
它能计算一个数的正弦也许令人吃惊
Now it might be very impressive that it can produce the sine of a number,
110
00:05:53,536 --> 00:05:58,970
但它显然是机械式的
but that at least is apparently possibly mechanical.
111
00:05:58,970 --> 00:06:01,712
至少 我可以像打开GCD机器一样打开它
At least, I could open that up in the same way I'm about to open GCD.
112
00:06:02,690 --> 00:06:04,368
也就是说 它其中可能有一整台计算机
So this may have a whole computer inside of it,
113
00:06:04,688 --> 00:06:05,696
但这并不有趣
but that's not interesting.
114
00:06:05,940 --> 00:06:07,104
加法相当简单
Addition is certainly simple.
115
00:06:08,200 --> 00:06:09,840
不借助额外机制就可以完成
That can be done without any further mechanism.
116
00:06:10,890 --> 00:06:15,648
现在 如果我们来看另外的一部分:控制器
Now also, if we were to look at the other half, the controller,
117
00:06:15,936 --> 00:06:17,392
这一部分也非常简单
that's a part that's dumb, too.
118
00:06:18,190 --> 00:06:19,168
它负责按下按钮
It pushes the buttons.
119
00:06:20,350 --> 00:06:21,520
它根据指令序列来按按钮
It pushes them according to the sequence,
120
00:06:21,552 --> 00:06:22,848
指令是写在纸上的
which is written down on a piece of paper,
121
00:06:24,272 --> 00:06:25,648
控制器还会观察指示灯
and observes the lights.
122
00:06:26,290 --> 00:06:29,440
而且每隔一段 它就会来到指令序列中的一处
And every so often, it comes to a place in a sequence that says,
123
00:06:29,472 --> 00:06:32,370
如果指示灯A亮 则执行某段指令
if light A is on, do this sequence.
124
00:06:32,370 --> 00:06:33,856
否则执行另外的指令
Otherwise, do that sequence.
125
00:06:34,620 --> 00:06:37,456
因此 这其中也没有什么复杂的
And thereby, there's no complexity there either.
126
00:06:38,350 --> 00:06:39,328
那么 让我们来画一下
Well, let's just draw that
127
00:06:39,344 --> 00:06:40,570
然后来感受一下它
and see what we feel about that.
128
00:06:42,510 --> 00:06:44,848
为了计算GCD
So for computing GCDs,
129
00:06:45,888 --> 00:06:49,520
你们要知道:这其中有一些寄存器
what I want you to think about is that there are these registers.
130
00:06:50,560 --> 00:06:53,024
这里 寄存器就是一个存储数值的地方
A register is a place where I store a number, in this case.
131
00:06:53,520 --> 00:06:54,656
这个寄存器存储的是A
And this one's called a.
132
00:06:56,810 --> 00:06:58,700
而另外的这个存储的是B
And then there's another one for storing b.
133
00:07:03,170 --> 00:07:05,456
现在我们来看看 有了这些寄存器后能做什么
Now we have to see what things we can do with these registers,
134
00:07:05,980 --> 00:07:08,736
至于你能利用它做什么 并不是很明显
and they're not entirely obvious what you can do with them.
135
00:07:09,840 --> 00:07:11,728
那么 我们必须看看需要用它们做什么
Well, we have to see what things we need to do with them.
136
00:07:11,824 --> 00:07:13,872
我们来看看尝试求解的问题
We're looking at the problem we're trying to solve.
137
00:07:14,030 --> 00:07:16,096
计算机设计的一个要点就是
One of the important things for designing a computer,
138
00:07:17,104 --> 00:07:19,584
我想大多数设计师都不会照做
which I think most designers don't do,
139
00:07:20,208 --> 00:07:21,888
也就是专注于待解的问题
is you stay the problem you want to solve
140
00:07:22,624 --> 00:07:25,180
然后使用你研究问题所学到的东西
and then use what you learn from studying the problem you want to solve
141
00:07:25,440 --> 00:07:27,280
把那些求解问题所需要的机制
to put in the mechanisms needed to solve it
142
00:07:27,530 --> 00:07:28,700
融入正在构建的计算机中
in the computer you're building,
143
00:07:28,816 --> 00:07:30,080
不多也不少
no more no less.
144
00:07:32,140 --> 00:07:33,968
现在 可能你所要解决的问题
Now it may be that the problem you're trying to solve
145
00:07:34,240 --> 00:07:35,408
是大家共有的问题
is everybody's problem,
146
00:07:36,060 --> 00:07:37,584
这种情况下你需要构建
in which case you have to build in a universal
147
00:07:37,600 --> 00:07:39,290
某种语言的通用解释器
interpreter of some language.
148
00:07:40,190 --> 00:07:42,320
但是你添加的机制不能比
But you shouldn't put any more in than required
149
00:07:42,352 --> 00:07:44,256
想构建的语言解释器的需求多
to build the universal interpreter of some language.
150
00:07:44,448 --> 00:07:45,856
这一点 我们稍后来讨论
We'll worry about that in a second.
151
00:07:47,232 --> 00:07:49,930
好了 让我们回到这里
OK, going back to here, let's see.
152
00:07:49,930 --> 00:07:51,248
我们必须能够做什么?
What do we have to be able to do?
153
00:07:51,792 --> 00:07:54,144
首先 我们能把B的值赋给A
Well, somehow, we have to be able to get B into A.
154
00:07:56,080 --> 00:07:59,600
我们要能够把B的旧值赋给A
We have to be able to get the old value of B into the value of A.
155
00:08:00,380 --> 00:08:03,328
因此 我们需要某种能够让数据流通的“路径”
So we have to have some path by which stuff can flow
156
00:08:03,344 --> 00:08:04,760
而不管数据具体是什么
whatever this information is,
157
00:08:05,376 --> 00:08:06,576
从B到A的通路
OK? from b to a.
158
00:08:07,390 --> 00:08:09,264
我箭头来指示
I'm going to draw that with by an arrow
159
00:08:09,520 --> 00:08:12,624
我们能够把B的值赋给A
saying that it is possible to move the contents of b into a,
160
00:08:12,960 --> 00:08:14,576
从而替换A的旧值
replacing the value of a.
161
00:08:15,120 --> 00:08:16,736
当你按下这里的按钮后
And there's a little button here which you push
162
00:08:17,488 --> 00:08:18,560
就能够实现这个效果
which allows that to happen.
163
00:08:19,710 --> 00:08:20,784
这个按钮就在这里
That's what the little x is here.
164
00:08:23,070 --> 00:08:23,936
同样的
Now it's also the case
165
00:08:23,952 --> 00:08:26,288
我还需要能够计算A除B的余数
that I have to be able to compute the remainder of a and b.
166
00:08:27,000 --> 00:08:28,496
这可能混乱而又复杂
Now that may be a complicated mess.
167
00:08:28,860 --> 00:08:30,864
但另一方面 我会把它放到一个小盒子中
On the other hand, I'm going to make it a small box.
168
00:08:31,960 --> 00:08:33,920
如果有必要的话 我们可以打开那个盒子
If we have to, we may open up that box
169
00:08:34,128 --> 00:08:35,632
看看其中有些什么
and look inside and see what it is.
170
00:08:37,770 --> 00:08:39,168
这就是那个小盒子
So here, I'm going to have a little box,
171
00:08:39,200 --> 00:08:40,380
我这么来画它
which I'm going to draw this way,
172
00:08:43,168 --> 00:08:44,384
我把它叫做REM
which we'll call the remainder.
173
00:08:46,440 --> 00:08:48,608
它接受A
And it's going to take in a.
174
00:08:50,910 --> 00:08:52,160
同时也要接受B
That's going to take in b.
175
00:08:54,370 --> 00:08:56,512
它有一个输出
And it's going to put out something,
176
00:08:58,896 --> 00:09:00,464
也就是A除以B的余数
the remainder of a divided by b.
177
00:09:02,290 --> 00:09:03,616
在这里 我们同样需要能够
Another thing we have to see here is
178
00:09:03,648 --> 00:09:06,060
判断B是否等于0
that we have to be able to test whether b is equal to 0.
179
00:09:08,000 --> 00:09:09,664
也就是说 总得有个东西
Well, that means somebody's got to be looking at--
180
00:09:10,000 --> 00:09:12,304
去查询B的值
a thing that's looking at the value of b.
181
00:09:13,390 --> 00:09:14,400
这是一个指示灯
I have a light bulb here
182
00:09:15,856 --> 00:09:17,390
当B等于0时 它就会点亮
which lights up if b equals 0.
183
00:09:21,110 --> 00:09:22,016
它就是干这个的
That's its job.
184
00:09:24,030 --> 00:09:26,784
最后 因为我们希望
And finally, I suppose, because of the fact
185
00:09:26,960 --> 00:09:30,432
A的新值是B的旧值
that we want the new value of a to be the old value of b,
186
00:09:30,464 --> 00:09:34,416
同时B的新值是有关于A的
and simultaneously the new value of b to be something I've done with a,
187
00:09:35,280 --> 00:09:37,600
如果我打算让机器
and if I plan to make my machine
188
00:09:37,808 --> 00:09:39,744
一次只发生一件事
such that everything happens one at a time,
189
00:09:40,208 --> 00:09:41,408
一次执行一个动作
one motion at a time,
190
00:09:41,616 --> 00:09:43,424
并且我不能在一个寄存器中放两个数字
and I can't put two numbers in a register,
191
00:09:44,032 --> 00:09:46,300
那么进行互换时 必须有另外的地方放置一个数字
then I have to have another place to put one while I'm interchanging.
192
00:09:49,296 --> 00:09:49,600
对吧?
OK?
193
00:09:50,000 --> 00:09:51,856
我不能同时交换两手的东西
I can't interchange the two things in my hands,
194
00:09:52,110 --> 00:09:53,728
除非我一手拿两个
unless I either put two in one hand
195
00:09:53,728 --> 00:09:55,130
然后从中取另外一个
and then pull it back the other way,
196
00:09:55,504 --> 00:09:56,912
或者我先放下一个
or unless I put one down,
197
00:09:57,024 --> 00:09:58,688
取得另一个后再像这样捡起来
pick it up, and put the other one, like that
198
00:09:59,648 --> 00:10:00,944
除非我是耍杂技的
unless I'm a juggler,
199
00:10:01,660 --> 00:10:03,500
当然正如大家所见 我并不是
which I'm not, as you can see,
200
00:10:04,656 --> 00:10:07,360
这种情况下 我就会遇到时序错误
in which case I have a possibility of timing errors.
201