What lambda that does, it creates on the fly a function, as the program runs. That I can then pass around.
这里的入是在函数运行的时候,由一个函数创建的,然后我会传递这个值。
But when you pass a parameter say, a list, you didn't think that you were not only passing the list, you were also passing the functions that operate on the list. In fact you are.
你不会认为你输入的不仅仅是链表,你还传递了处理链表的函数,实际上你正是这么做的,这往往不重要。
f Well, call toupper pass this lowercase F F to this function called toupper it's going to return capital F and so what do I assign to s2 bracket zero?
调用toupper函数,传递这个小写,然后返回的是大写的,那么我对s2【0】赋值多少?
When you think about an int or a float or a dictionary or a list, you knew that there were functions that operated on them.
当你想到整型,浮点型,或者链表时,你知道可以用函数去处理他们,但是当你传递一个参数,例如链表。
In some sense, strictly speaking they shouldn't be necessary because the fact that my specification starts with an assumption, says, hey you, who might call square root make sure that the things you call me with obey the assumption.
在某种意义上严格的来讲,它们不是必要的,因为我已经对假设做了声明,也就是说,如果你要调用我的,求平方根的函数,请确保你传递给我的,参数满足假设条件。
It's passing to this function called toupper, which if you've never used it it actually does what it says it makes it touppercase.
它把这个传递给toupper函数,如果你们使用过,它表示的是把小写字母,转换为大写字母。
If you pass a function in C, a value that it's not expecting bad things happen and bad things generally reduce to segfault.
如果你在C中传递一个函数,一个没有预料的情况将会出现,这个情况通常是段错误。
I certainly don't want to assume they're always going to type a three-letter or a four-letter or a two-letter word I want some dynamism but that's fine because get string can get a string of any length, I can then use the string length function to just ask while the program is running how big is the string that I was handed?
当然我不能假设他总是,输入3个字符或4个字符,或2个字符的单词,我想要动态地分配,因为GetString可以获得任意长度的字符串,然后我可以使用strlen函数,来得到那个我传递的字符串,有多长?
应用推荐