4. Ruby 函数式:
[1,2,3].map {|n| n * n}.reject{|n| n % 3 == 1}
=> [9]
经过比较,ruby的最为简洁,而且与问题描述对应的最自然。
--
Welcome to my blog ( about Python , Lisp)
http://albertlee.cublog.cn/
_______________________________________________
python-chinese
Post: send python-chinese@lists.python.cn
Subscribe: send subscribe to python-chinese-request@lists.python.cn
Unsubscribe: send unsubscribe to python-chinese-request@lists.python.cn
Detail Info: http://python.cn/mailman/listinfo/python-chinese