如何立即ruby中的symbol

Python011

如何立即ruby中的symbol,第1张

Python和Ruby接近方便面,短平快立刻有结果。Lisp 接近怀石料理,每一个作品都是自己琢磨出来的。你要是有写这个的经历应该很能理解,写 Ruby 和 Python 的时候写的时间可以很长,但 Lisp 很有可能想一天写出来只有一行。

经常看到一些写法,比如

我们知道, &符号在ruby中是用来调用块的,而 : 符号一般是表示symbol类型,通常用来表示方法,或者调用类的实例变量(实例变量需要在类中用attr_reader或者attr_accessor声明。)

所以,上面的表达方式等同于 array.uniq {|a| a.first}.sort_by {|x| x.last}

即先按照数组第一个元素去重,然后再按照数组的最后一个元素排序。

http://stackoverflow.com/questions/1217088/what-does-mapname-mean-in-ruby 参考第一个答案。

1, Germany

(A) of the German Community

1, clothing: adult men in general XizhuanggelvPresident Taoqun the suit, Zhuguangbaoqi, while most of Germany old woman Aichuan brightly coloured Yiqun.

2, Fresh: German to bread, meat, potatoes (nutrient-rich) mainly food. Therefore, more German overweight, Hongguangmanmian.

(B) social etiquette

1, Xianmian Li: In Germany, two pairs of couples to meet, the first female pay tribute to each other, and then the other men were to pay tribute to the wife, finally pay tribute to each other.

2, Daojiu ceremony: German guests at the dinner, wine bottles out of the Muse, the first to own a small inverted mouth glasses of liquor, and then the guests Zhenman wine glasses.

Second, France

(A) of French cuisine served in the order:

First over the soup. The second route sampler plates, mostly Rouchang, ham meat. Third Road Taicai (also known as the "main course", "is cooking"), is usually fried steak, burning mutton, chicken, seafood and so on. Fourth over the vegetables. Fifth Road to all kinds of cheese. Sixth over the cake, chocolates and other sweets and cold drinks. 7 over the fruit and coffee. The last one is brandy or champagne. In addition, fasting in the French habit of drinking whisky, and so is an aperitif. During the banquet, equipped with colored long bread and wine. French people like to drink. France is famous brandy, champagne's hometown, hotels around the towns and villages. French focus on wine and food combination, eat meat, drink red wine, eat fish and seafood, drinking white wine.

(B) social etiquette

1, the handshake ceremony: in France use the handshake ceremony. When you enter the office of French people, you should be at the scene, and all shook hands, should also leave and shook hands with all present to bid farewell.

2, "Knight" demeanor: in France, public occasions, most men will be treated courteously met or not met the women. When the President entered the room, men have to stand up. His people were guests, the first pay tribute to the hostessfarewell from the hostess, thank. Men and women dine together, a la carte, served, the President shall propose a toast priority. Male and female counterparts, men have to drive, gate, doorallocation, the President walk in front of menXialou when man firstlift and by car, both men should show backwardtrain, men The window seat to give President.

3,'s ceremony: education is very particular about the Frenchman's courtesy, talk with people, warm and generous attitude, tone, natural,和蔼, elegant words of euphemism, the voice of moderate level, the election of our public topic (culture, education, sports), Not to impose their point of view.

Third, the United Kingdom

(A) of the British Marriage

1, the jewel on the engagement ring: Ruby symbol of love specifically, the symbol of the same feelings of sapphire, emeralds symbol of hope.

2, the groom, the bride's responsibility: the bride is responsible for preparations for the wedding, wedding, the groom is responsible for layout new homes, the burden of wedding rings and wedding costs.

(B) social etiquette and taboos

1, "gentleman" demeanor: British men advocating gentlemanly demeanor, followed in social occasions, "Ms. priority" (Ladies first.) Principle. His speech, his opening remarks to always say "Ladies" and say "Gentlemen." In restaurants, set an initial women served the guests, give men and guests served. When the vessel encountered crisis, we must let women, children on the lifeboats first. Into the theatre or cinema, also should be allowed to walk in front of President. Cloakroom to store clothing, for men to take off the coat or jacket, good storage, and then kept their coats or jackets.

2, Jing Cha ceremony: the British like to please his friends drink tea and friendship. British people usually drink tea without milk and sugar, tea, with biscuits, sandwiches or small bread.

3, bogey asked a private matter: British Gas like to chat, talk about news, but others asked the taboo private matter, especially taboo woman asked the age and marital status. In day-to-day contacts, do not ask people come from, Where «Do not ask other people's income, savings and price, rent, etc., do not ask what others belong to one party (the Labour Party or the Conservative Party), who voted in the election Votes.

4, hate Peacock:character of the British people hate peacocks that Peacock is "sex birds," Peacock is a self-screen show.