Y组合子 Y组合子的用处 作者:王霄池链接:https://www.zhihu.com/question/21099081/answer/18830200来源:知乎著作权归作者所有.商业转载请联系作者获得授权,非商业转载请注明出处. Y组合子的用处是使得 lambda 表达式不需要名字. 如你所说,阶乘函数可以这样定义: let F = lambda n. n==0 ? 1 : n*(F n-1) 当我们需要调用的时候,我们只需要这样写就可以了: F 4 但你有没有想过,如果我们没有 let 这…
不动点组合子 Y = λf. (λx. f (x x)) (λx. f (x x)) θ = (λx. λy. (y(x x y))) (λx.λy.(y(x x y))) Y f = f (Y f) θ f = f (θ f)设 h1 =λx.f(x x) h2 =λx.λy.(y(x x y)) 简化为: Y = λf. h1(h1) θ = h2(h2) 递归求解ƒ(n) = n*ƒ(n-1)ƒ(0) = 1简记为: ƒ = λn.n׃(n-1) #ƒ对应代码中的 factorial用归…
学习sql中的排列组合,在园子里搜着看,看到篇文章,于是自己(新手)用了最最原始的sql去写出来: --需求----B, C, F, M and S住在一座房子的不同楼层.--B 不住顶层.C 不住底层.--F 既不住顶层也不住底层.M 住得比 C 高.--S 住的楼层和 F 不相邻.--F 住的楼层和 C 不相邻. create table pailie (rnam varchar(20) ) select 'B' as rnam into #y union select 'C' union…
C#中多集合组合使用方法,主要用到 Enumerable.Join方法 var skuInfoList = new Dictionary<int, List<long>>(); var ctParamList = new List<long>(); foreach (var sku in skuList) { var singleSku = sku.Split('|'); ctParamList = new List<long>(); foreach (va…