//定义一个函数,传入block类型参数myBlock5int fun(int (^myBlock5)(int a,int b)){ return myBlock5(10,20);}int (^myBloak2)(int,int);myBloak2 = ^(int a, int b){ retu.....
分类:
其他好文 时间:
2015-11-04 13:12:31
阅读次数:
190
闭包其实就是利用了函数作用域和匿名函数的知识,当函数A执行结束时,一部分变量变量被B引用,被引用的变量不能释放,形成了所谓的闭包。这里有篇很好的文章,可以参考一下。下面看一个小例子:JavaScript12345678910function show(){var n=3;setTimeout(fun...
分类:
编程语言 时间:
2015-11-04 11:26:44
阅读次数:
197
#include "stdafx.h" #include <iostream> #include <windows.h> using namespace std; struct test{ char name[100]; }; ? DWORD WINAPI Fun(LPVOID lpParamter) { //test* t = (test*)lpParamter; char *c = (...
分类:
编程语言 时间:
2015-11-03 12:43:03
阅读次数:
387
用来得到中文的首字母:这个是将中文转换为拼音的类:charset160){ //如果是中文,再多截取一个字符$q=ord(substr($str,++$i,1));$p=$p*256+$q-65536;}$ret.=$this->convert($p);}return $ret;}//转化函数fun...
分类:
Web程序 时间:
2015-11-03 12:04:35
阅读次数:
213
CREATE OR REPLACE PACKAGE pak_02 IS--包头--这里可定义公共参数FUNCTION fun_01 RETURN NUMBER;PROCEDURE pro_01 ;END;CREATE OR REPLACE PACKAGE BODY pak_02 IS--包体--这里...
分类:
数据库 时间:
2015-11-02 15:46:44
阅读次数:
189
简单列表处理 上一节我们重点介绍了fun,现在我们继续编写sum和map,来改进我们之前实现的total总和的计算.新建一个mylists.erl1 -module (mylists).2 -export ([sum/1]).3 4 sum([H | T]) -> H + sum(T)...
分类:
其他好文 时间:
2015-11-01 13:51:11
阅读次数:
173
1、计算距离的公式比较长(网上查找),建一个mysql函数: delimiter $$
CREATE FUNCTION FUN_JW_DIST(lng1 double(15,9), lat1 double(15, 9), lng2 double(15,9), lat2 double(15,9))
RETURNS double(15,9)
B...
分类:
数据库 时间:
2015-11-01 07:00:09
阅读次数:
302
什么是柯里化柯里化允许我们把函数与传递给它的参数结合,产生一个新的函数。[引自《JavaScript语言精髓》,第43页 柯里化]A function is said to be curried when not all arguments have been supplied to the fun...
分类:
编程语言 时间:
2015-10-30 14:05:57
阅读次数:
178
events 事件有两种:System Events C++ Core libuv Custom Events JavaScript Core Event Emitter一.The node event emitter1.创建 Emitter module 新建 emitte.js文件代码如下fun...
分类:
Web程序 时间:
2015-10-29 12:43:22
阅读次数:
229
2.#include<stdio.h>intfun(intn){if(n%400==0||(n%4==0&&n%100!=0))printf("Yes!\n");elseprintf("No!\n");}intmain(){intyear;printf("请输入年份:");scanf_s("%d",&year);fun(year);system("pause");return0;}
分类:
其他好文 时间:
2015-10-28 19:31:07
阅读次数:
130