本文展示加法和乘法的两个例子,最后使用MapReduce的思想把两者统一成一个带Currying的表达形式。从high-order functions推演到Currying原始方法def sum(f: Int => Int, a: Int, b: Int): Int =
if (a > b) 0
else f(a) + sum(f, a + 1, b)表示从a到b,把每个int做一次f处理,...
分类:
其他好文 时间:
2015-05-01 00:42:36
阅读次数:
155
二维饼图代码如下:#绘制2维饼图
x=read.delim("C:/Users/a/Desktop/sample.txt",header=FALSE)#读入文本数据
names(x)=c("word","count")#加表头
x=transform(x,pct=round(x$count/sum(x$count)*100))#数据框增加百分比列
y=x[order(x[,2],decreasing=T),]#排序
z=head(y,n=10..
分类:
其他好文 时间:
2015-04-30 20:29:36
阅读次数:
197
Mysql语句优化范例1:优化语句SELECT*FROM`tbl_order_buy_eta`WHERE`id_order`=1843#通过explain分析语句结果如下
mysql>explainSELECT*FROM`tbl_order_buy_eta`WHERE`id_order`=1843\G
***************************1.row***************************
id:1
select_type:SIMP..
分类:
数据库 时间:
2015-04-30 20:26:47
阅读次数:
150
http://www.oracle.com/technetwork/issue-archive/2006/06-sep/o56asktom-086197.htmlselect*
from(selectrow_.*,rownumrownum_
from(selectt.idcard,count(1)
fromsampling.v_unvoucher_blacklistt
where1=1
groupbyt.idcard
orderbycount(1)asc)row_
whererownum<..
分类:
数据库 时间:
2015-04-30 20:18:52
阅读次数:
157
Given a binary tree, return the zigzag level order traversal of its nodes' values. (ie, from left to right, then right to left for the next level and alternate between).
For example:
Given binary ...
分类:
其他好文 时间:
2015-04-30 18:13:52
阅读次数:
137
Search for a Range
Given a sorted array of integers, find the starting and ending position of a given target value.
Your algorithm's runtime complexity must be in the order of O(log n).
If ...
分类:
其他好文 时间:
2015-04-30 16:19:15
阅读次数:
133
网络购物很流行,那么最流行的支付手段估计应该是支付宝了,那么怎么样将支付宝集成到自己的环境中呢,今天我来讲一下如何在springside框架中集成支付宝支付功能。
首先,我们去支付宝商家服务页面去注册和申请支付功能,并在那里下载sdk开发包https://b.alipay.com/order/productDetail.htm?productId=2012111200373124,这个是支付宝的...
分类:
编程语言 时间:
2015-04-30 12:41:57
阅读次数:
167
?= 赋值,当变量未定义过时赋值,否则不赋值 |用于定义order-only prerequisite 在makefile中使用$时,如果不是用来引用变量或者调用函数时,需要用$$来表示一个普通的字符$ 如: define CSERVICE_TEMP $$(CSERVICE_PATH)/$(1).s...
分类:
其他好文 时间:
2015-04-30 12:04:51
阅读次数:
120
题目Given a set of distinct integers,S, return all possible subsets.Note:Elements in a subset must be in non-descending order.The solution set must not ...
分类:
其他好文 时间:
2015-04-30 12:03:36
阅读次数:
81
1.生成订单信息
AlixPayOrder *order = [[AlixPayOrder alloc] init];
order.partner = PartnerID;
order.seller = SellerID;
order.tradeNO = [self generateTradeNO]; //订单ID(由商家自行制定)
order.productName...
分类:
其他好文 时间:
2015-04-30 08:57:37
阅读次数:
145