We need to know not only what are the primitives, but how do we make things meaningful in that language.
我们不仅需要知道什么是基本类型,还要知道我们在那种语言中,怎样使其变得有意义。
Data's what we expect. It's our way of representing fundamentally the kinds of information we want to move around.
数据是我们一直需要的,它是用来表达我们想要操作的,数据类型的基本方式,这里。
But out of the box, you generally just get these so-called "primitives."
但是立即可以用的,我们通常只有这些所谓的“基本数据类型“
It is structured and ordered into a few basic regime types. In this I take it to be one of the most important propositions and ? insights of political science. Right? So far?
它是经建构与安排成,数种基本的政体类型,这个在我看来,是其中一个最重要的政治科学主张与见解,还好吗,到目前为止还懂吗?
Given a fixed set of primitives, all right, a good programmer can program anything.
对,给出一对混乱的基本类型,对了,一个优秀的编程师可以编出任何程序来。
We've looked so far really at two non-scalar types. And those were tuples written with parentheses, and strings.
关于这两种基本类型我们已经,学的相当多了,包括哪些元组和字符串类型。
It says, with six primitives, I can rule the world. With six primitives, I can program anything.
它说,用六个基本类型,我可以规定整个世界,用六个数字,我可以编写任何程序。
OK. Now, fortunately we're not going to start with Turing's six primitives, this would be really painful programming, because they're down at the level of, "take this value and write it onto this tape."
好了,现在,幸好我们能开始讲述,图灵的六个基本类型了,这会是非常痛苦的编程,因为它们只在这个阶段上,“拿到这个结果并写在这一卷磁盘上“
Alan Turing In 1936, that same guy, Alan Turing, showed that with six simple primitives, anything that could be described in a mechanical process, it's actually algorithmically, could be programmed just using those six primitives.
在1936年,还是那个人,展示了六个基本类型,可以在计算过程中,表达出任何含义来,其实这是演算性质的,可以根据六个数字编程。
I get the int and store it in n. The switch statement takes inside its parenthesis an int or a char or some primitive type.
我得到一个整数并把它存储,到n中,switch语句的圆括号里可以是一个整数,或者一个字符或其他的基本类型。
All right, the question is, as I started to say, is, "What are the right primitives?"
好了,就像我刚开始说的,问题在于,“什么才是正确的基本类型呢?“
So one of the questions is, well, what are the right primitives to use?
因此问题之一是,好吧,要使用的正确基本类型是什么呢?
A broader set of primitives, but nonetheless the same fundamental thing holds.
一些广阔的基本类型,但还是同样的基本东西。
With those six primitives, you can do it.
用六个基本类型你能做的。
And one of the things that was useful here is, that we actually know that the set of primitives that you want to use is very straight-forward.
这儿有一个很有用的东西是,我们实际知道你想用的,一系列基本类型是非常明显的。
And by that, I mean anything that can be described in one of these process, you can capture in that set of primitives.
对于那个,我的意思是任何东西,都可以用这个流程中的一部分来表达出来,你可以从那堆基本类型中间挑选。
Second thing we saw was, we saw that associated with every primitive value was a type.
我们学习到的第二件事情是,和每个基本值对应的,是一个类型。
What we're saying is, in order to do computation, we want to describe recipes, we want to describe this sequence of steps built on some primitives, and we want to describe the flow of control that goes through those sequence of steps as we carry on So the last thing we need before we can start talking about real programming is, we need to describe those recipes.
我们在说,为了做计算,我们想描述一个方法,想描述建立在,相同基本类型上的步骤序列,而且我们想描述经过我们设计的,步骤的序列的,控制流程,因此我们开始谈论真正的编程之前,的最后一件事是,我们需要描述一下那些方法。
All right. I want to return to some non-scalar types. So we've been looking, the last couple of lectures, at floating pointing numbers and integers.
好,我们现在回到一些,非基本类型的话题来,我们在过去的几节课里,一直在研究浮点数类型和integer类型。
应用推荐