Yesterday morning,When I read the 4.2.3 chapter of the ruby book named <Programming Ruby>,I couldn't understand the meaning of this chapter.I have been reading this book for 2 weeks,but I only read fifty pages.I thought of the speed was too slowly and it was waste of time,then I bought a Chinese version of this book.
After I bought the Chinese book I know the meaning of 'Closure'.'Closure' is a new jargon which I had heard of a year ago.Although I know it,I didn't know what it means.The following is a example which is showed in <Programming Ruby>,but I don't know where I can use this new feature.
ruby 代码
- def n_times(thing)
- return lambda {|n| thing * n }
- end
- p1 = n_times(23)
- p1.call(3) ! 69
- p1.call(4) ! 92
- p2 = n_times("Hello ")
- p2.call(3) ! "Hello Hello Hello "
This blog might be finished yesterday afternoon,but it was delayed by other thing.I wrote this blog as soon as I came in my office on this morning.
分享到:
相关推荐
If you never actually bought a complete version of Quake, you might want to rummage around in a local software bargain bin for one of the originals, or perhaps find a copy of the "Quake: the ...
For my first three years I worked very hard and put in lots of hours, and I bought and read even more books. Books like Dan Appleman's Programmer's API, which I didn't understand for over a year ...
If you never actually bought a complete version of Quake, you might want to rummage around in a local software bargain bin for one of the originals, or perhaps find a copy of the "Quake: the ...
I agree with everything that the winner of the Nobel Peace Prize, Dr. Muhammad Yunus wrote about in creating a global economy based on social capitalism for developing economies. Although I am not an ...
在小学六年级英语下册 Module 6 Unit 1 "I bought a book for you" 的课程中,学生们将学习与太空、旅行以及兴趣相关的词汇和语言结构。本课的重点包括动词"give"和"buy"的用法,以及形容词"interesting"和...
EVALUATION LICENSE AGREEMENT (this does not apply if you already bought the full version) IMPORTANT - READ CAREFULLY This license statement constitutes a legal agreement between you (either as...
Python is rapidly becoming the standard ... I bought the advanced python book too." "The most useful guide to Python I've found...I've tried a few Python books, and this is by far the best for me.
这篇内容主要围绕的是小学六年级英语下册Module 6 Unit 1的一课,主题是"I bought a book for you",适合外研社出版的一起使用版本。课件中涉及了动词的过去式,如"bought, gave, sent"等,并通过一系列问题帮助学生...
gned using one of the most popular web programming languages today, JSP, ensuring flexibility and efficiency. The system relies on MySQL as its database, enhancing data security, while Tomcat server ...
If you have ever bought any programming books, you might have noticed that there are two types of them: books that are too short to understand the topic and books that are too long making it ...
but it was quite popular), but after I bought a Nexus 5, it started to have problems -- it would go for hours without updating the grah at all, which made it quite useless. I contacted the developer,...
7. "I bought the same dress. You wore the dress yesterday." 可以合并为 "I bought the same dress that you wore yesterday." 8. "He is such a kind teacher. We all like him." 可以合并为 "He is such a kind...
15. We can see many of the stars in the sky. → Many of the stars can be seen in the sky. 16. You mustn’t park the car here. → The car must not be parked here. 17. The boss made the workers work ...
4. Recently I bought an ancient Chinese vase, the price of which was very reasonable. which指代vase,说明价格合理。 5. Last week, two persons came to see the house, neither of whom wanted to buy it. ...
3. "The price of the dress is 300 yuan, but I bought it at the price of 210." 变为 "The price of the dress is 300 yuan, but I bought it at a 30% discount." 4. "He felt sorry that he promised to go to ...
3. "No, I bought nothing." 回答没有买东西。 4. "It is always like that during such a holiday." 描述假期期间的普遍情况。 5. "Neither will I." 表示自己也不会在公共假期去旅行。 通过这些练习,学生可以...
This book is my attempt to share with the world the journey I’ve taken from “hack‐ ing” to “software engineering”. It’s mainly about testing, but there’s a lot more to it, as you’ll soon see....