But let me use the term "event" anyway, employing it with caution and as if in quotation marks.
但是无论如何我还是使用,“事件“,这个词,小心谨慎地使用它,带引号地使用。
And the main one is, I get to just decide, how do I want to use this, and call it.
但是这真的会有一些好处,最重要的一点是,我需要决定,我要如何来使用这个方法,以及如何来调用它。
If we weren't so pressed for time, I kinda wanna see how long we could get away with this before it gets awkward, but that, in fact, is an infinite loop t hat's hopefully deliberate.
如果有时间,我想看看,我们需要花多长时间解决这一问题,事实上,它是我故意,使用的无穷循环。
So when I use the word "Soul," I will try to reserve it for the metaphysical view, according to which souls are something immaterial.
所以当我使用"灵魂"这个词时,我将会把它用在形而上学的观点里,这种观点认为,灵魂是非物质的
Except,I mean,you could use it, but not use it as authoritative.
我的意思是你可以使用它,但不要把它当作权威。
And typically, I'm not going to just search once in a list, I'm going to search multiple times.
还要考虑我要如何去使用它?,我不会对一个列表只做一次搜索。
My prototype, again, so that I can use it later increment without the compiler wondering what is this increment that you're referring to because it's not otherwise been declared.
我的函数原型,再次强调,我可以以后使用它,这样编译器就不会疑惑这个你提及的,是什么,因为是没有,被声明的。
It's a common mistake to make if you forget that I've actually declared that variable up top, but wait a minute, I know any time that I use a variable, I have to declare it.
这是一个通常犯的错误,如果你忘了,之前在前面已经声明了这个变量,等等,我知道在任何时候,我使用一个变量,我必须声明它。
Because if I don't specify a name for this input, I have no way of actually referring to it in subsequent lines of code.
因为如果我不给这个输入定义一个名字,在随后的代码中,我就没有办法使用它。
And the idea behind recursion I'm going to describe with a simple example. And then I'm going to show you how we can actually use it.
但是为了解释递归的意义,我想举个简单的例子,我将会给你们展示我们该如何使用它。
It's instead outside of them and, by convention, at the top of the file so that I can access it anywhere, whether or not this is a good thing, remains to be seen.
它在函数的外面,按照惯例,在文件的顶端,所以我可以在任何地方使用它,不管这是不是好事情,拭目以待。
I want to just use it, I shouldn't have to worry about what variables I use inside of it, I have shouldn't have to worry about where that is in the code, I should be able to just abstract it away. And that's what we want to add today, are those two things.
我只是想使用它,我不用考虑我在这段代码中,使用的是什么变量,我完全不用考虑代码的内容,只要抽象就好,我们今天想补充的内容就是这两点。
n I know this is okay because I'm not using n until I myself put something there.
我知道这是正确的因为我不会使用,直到我给它赋值了。
I need access to more memory, and I need it fast.
我需要使用更多内存,想要它更快点。
What is this? This is a wonderful piece of abstraction. It is saying, you don't need to know squat about what's inside the body of this function. You don't have to worry about the parameter names, because they're going to be preserved, you don't need to worry about how I'm doing it, this tells you how you can use this, in order to use it correctly. Of course, I can then close it off, and off we go.
但是这能告诉你一些信息,这是什么?,这是一段完美的抽象,它的意思是你不需要知道,这个函数的内部构造,你不必担心参数是否重名,因为它们已经被预存了,你不需要担心我如何使用它,它告诉了你你该如何操作,从而正确的使用它,当然我也可以把它关掉。
Now that I've written sqrt, I can just use it anywhere I want in the code. You've got to rely on the fact that I wrote it correctly, but you can basically suppress the details of how it's used.
就是忽略细节,既然我已经编写了sqrt函数,我可以在代码的任何地方使用它,你完全可以依靠,我已经编写的这个函数。
So even though increment is obviously increment declared and defined in this function, it's later; so it's too late for me to use it in main.
很明显,即使在这个函数中,已经声明和定义;,也太迟了,以至于,我在main函数中不能使用它。
If I know I'm going to need something over and over again, I squirrel it away somewhere and then get it back when I need it.
如果我知道我将要反复,使用一个东西时,我会把它贮藏起来以后用。
I can use that to return values, which I can then use elsewhere, which I did-- and if I just come back and highlight this-- inside of that computation.
我可以用它来返回值,然后我可以在别的地方使用这些返回值,正是我做的--如果我回过头来,在高亮一下这个--在这部分计算内部。
This is me writing one hour of that episode of Pirandello and telling the other authors, here's what I'm assuming as you use it. So it's up to me to do it right, but if I do it, I'm going to specify, what does this function do?
作为一个程序员,我得为用户提供一些信息,这正是我写写的皮兰德娄戏剧的一小时片段,并且要告诉其它的作家,这是我希望你使用的地方,所以由我决定怎样去做好它?
It's a little more readable because I'm using a Boolean value that tells me, the programmer, this is true or this is false.
它更具有可读性一点,因为我使用了一个bool值,它告诉我或程序员,这是正确的或这是错误的。
I said, use the name mystring to be bound to or have the value of Eric, so I can refer to it anywhere else that I want to use it.
用mystring这个名字,来绑定Eric这个值,这样我就能,在任何想用这个值的地方使用它了。
So pictorially, it's as though there's now some other part of the blackboard here, maybe way up here where I can put anything I want that's accessible to main, that's accessible to swap, that's accessible to increment or any other function I might implement because it is, in fact, global.
绘画般地,它是在这里黑板上的其他部分,可能在这里的上面,我在哪里可以放置这些东西,使它们可以被main函数使用,可以被swap函数使用,可以被increment函数使用,或者我所实现的其它函数,因为它实际上是一个全局变量。
First of all, two parameters. It's OK. All it says is, when I call this, I need to pass in two parameters for this to work. All right? Now, if I want to use that, I'm going to use a second piece of code here, called Barnyard. I'm going Barnyard to read in a couple of values, convert them into integers, and then I'm going to use solve to get a solution out.
注意我得到了什么,第一,两个参数,它的意思就是我调用这个函数,我得给它输入两个参数,明白了吗?,现在如果我要使用它我得用,这里的第二段代码,也叫,我将读入一组值,将它们转化为整型,然后我会用solve得到一个解决方案。
应用推荐