scala中的高阶函数
摘要:高阶函数val list =List(1,2,3,4,5,6,7,8)val newList = list.map((x:Int) => 2*x) //map表示映射list中的每一个元素的值为原来的2倍//newList中的值为2,4,6,8,10,12,14,16也可直接写成val newLis...
阅读全文
posted @ 2014-08-18 00:31
posted @ 2014-08-18 00:31
posted @ 2014-08-18 00:30