Why? Because that block identifies a set of things that I'm going to do if the test is true.
为什么呢?这是因为这一块指令,指定了一系列的要进行的操作,如果测试为真的话。
On Thursday, we'll look at why that allows you to do lots of things more conveniently than you can do without mutation.
周四我们会探讨下,为什么这种可变性会让你,在进行很多操作的时候方便了许多。
So thankfully, modern operating systems allow you to put parts of files here, parts of your file here, parts of your file here, but the end result is that your files get fragmented.
因此,谢天谢地,现代操作系统允许你,把这里的文件进行分块,在这里存一部分,在那儿存一部分,但最后的结果是你的文件变成了分片的。
You get these plots by taking the wave function times its complex conjugate and operating on that.
你也可以得到这些,通过波函数乘以,其共轭进行如上操作。
I mean, to the extent that you're making these short-term bets against your long-term policy, it requires trading and trading is expensive.
我的意思是,在长期策略下进行短期操作,就需要进行交易,而交易是昂贵的
We can do the same thing for the other observed kinetic energy.
我们还可以对观测到的,其它动能进行同样的操作。
And not just a camera but there are also tools on the end of these things so you can cut and you can do manipulations through this instrument.
除了摄像头外,在关节镜的末端还有其他的器械,你可以体外操纵这些器械进行切割等操作
One of the advantages of this is, that I don't have to worry about explicitly updating my variable. That happens for me automatically.
这样继续下去,这样做的一个优点是,我不用为更新变量来发愁了,程序会自动的为我进行这个操作,这一点很好。
OK, now that I've got that, we could think about what would I want to do with these points?
我也可以像以前那样,对它们进行赋值操作,好,现在我们已经有这些对象了?
It could be, preconditions I want to have on input It could be, explanations of specific things you're doing.
也可以是我对输入的预期是什么,也可以是,对代码,正在进行的特定操作的解释。
Which are actually things that take in a value and ask the computer to do something with it.
这其实也就是让计算机,对某个值进行某种操作。
Exactly, so you might have been thought especially in years past to defragment, so to speak, your hard drive once in a while.
你可能认为需要进行,碎片整理这种操作,也可以说硬盘驱动器有时需要你这么做。
In a moment, I'm gonna drag and drop in order to induce this right to do something.
一会,我要拖拽这些东西,来进行一些操作。
It actually lets you see how to get access to that pointer so you know what you're referring to.
怎么来取得指针,以得知在对什么进行操作,但是这是个简单的设计决定。
Linear algorithms tend to be things where, at one pass-through, you reduce the problem by a constant amount by one. If you reduce it by two, 1 it's going to be the same thing.
有问题么?,线性复杂度的算法,当进行了一个,常量级步数的操作的时候,将问题的规模缩小了一个。
So it makes sense to be able to say, look for many methods I do want to have a way of doing comparison, and I don't have to remember, at top level, what the name of the comparison method was.
所有我需要的对象进行操作,那么就可以这么说了,我想要在很多方法里面,去找做比较的方法,我并不需要记住,每一个比较的方法的名字。
It has a test in it, which is that while, while something is true, do something, but I want to keep doing it.
也有个测试在里面,也就是那个当,当一件事情为真的时候,做一些操作,但是我想一直进行判断。
And the code over here says, OK gee, if I'm in the base case do something.
如果我属于基础事件就进行一些操作,而我不是,所以往下看这儿。
Give you some examples. What have we talked about? We've talked about things like using comments to highlight what you're doing in the code, to make it easier to debug.
给大家举些例子,我们一直在强调什么来着?,我们讲过要用注释来说明,你在代码中进行的操作,以便于调试。
And then I could do things like again, say, okay having done, that let me just run it here, run that, so I've now got polar point 1, and polar point 2.
然后给它们赋值半径和角度,然后我可以进行刚才的操作,也就是说,对刚才的笛卡尔坐标进行的操作,让我们来运行下它吧,运行下,现在我有一个极坐标点。
And I want to basically try and use these things to do something with them.
我想要试试然后,用这些声明来进行一些操作。
If I now say, I'm going to go ahead and change the radius of this, something, my polar form did it right, but what happened to the Cartesian form?
如果我现在说,我要去改变这里的半径,一些这样的操作,我的极坐标形式,进行了正确的改动?
That's all I have to do and I have locked in the interest rate.
以上是我为了确定利率而进行的操作
I did it in 1925, but I've got it set up so that I will pay a hundred pounds in 1926 and I'll get this in 1927.
在25年进行投资操作,并通过安排,在26年投资一百英镑后,于27年收回以上回报
And so I'm going to go back to this idea of a class, and let's build the first of these, and that is shown right here on this piece of your handout.
你把半径加到一起,你不会把角度加到一起,你需要再笛卡尔坐标下,进行这个操作,那么我这里在讲的就是。
All right? And if you want to do other things, whoops, sorry-- and add them together, we will get out, again, a concatenation of that string. And these will, we'll let you work through the variations, but these are the simple expressions we can use.
对不对?如果你想要进行一些别的操作,哦,对不起-是加到一块,然后结果值也是,两个字符串的链接,这些会,我们会让大家慢慢学习变量,但是这些是我们能用的最简单的表达式。
That means starting at the first one, I'm going to do something to it. And what am I'm going to do? I'm going to take that character, convert it back into an integer, and add it into some digits. And I've done a little short hand here, which is I should have said some digits is equal to some digits plus this.
这意味着从第一个字符开始,我要对他们进行一些操作,我要去做什么呢?我要取得这个字符,然后把它转换为整数,然后加到某些数上面去,我在这里用了一些缩写,我本来应该写一个数字等于这个数字。
Notice in the class definition here, is there, this is the first thing that's got called, and I just called with the value for x and the value for y, and it went off and did something for me.
就在这里,这是第一个被调用的东西,我用x的值和y的值调用了它,然后这个方法继续进行,并为了做了一些操作。
All right, if this is purely a test of, if this is true do this otherwise I don't care, I don't need the ELSE clause in there to identify it. All right?
好,如果这真是一个测验,用来测试如果是真的那么进行一些操作,否则的话我不在乎,那么我不需要ELSE语句,来进行声明了对不对?
I spotted an error here, I could have spotted it by running it on different test sets, and using prints things, another way of doing it, but this idea of at least simulating it on simple examples lets you check a couple of important questions.
操作么?我在这里发现了一个错误,我也可以通过运行不同的测试集,或者运用print声明来发现这个错误,但是至少应该用简单的例子来手工模拟下,代码的思想可以让你,对一些很重要的问题进行检验。
应用推荐