zoukankan      html  css  js  c++  java
  • 偏函数

    维基百科中对偏函数 (Partial application) 的定义为:

    In computer science, partial application (or partial function application) refers to the process of fixing a number of arguments to a function, producing another function of smaller arity.

    翻译成中文:

    在计算机科学中,局部应用是指固定一个函数的一些参数,然后产生另一个更小元的函数。

    什么是元?元是指函数参数的个数,比如一个带有两个参数的函数被称为二元函数。

    举个简单的例子:

    function add(a, b) {
        return a + b;
    }
    
    // 执行 add 函数,一次传入两个参数即可
    add(1, 2) // 3
    
    // 假设有一个 partial 函数可以做到局部应用
    var addOne = partial(add, 1);
    
    addOne(2) // 3


    https://www.cnblogs.com/guaidianqiao/p/7771506.html
  • 相关阅读:

    python内存管理
    python-继承类执行的流程
    Redis-key的设计技巧
    Redis-误操作尝试恢复
    Python3之hashlib
    面相对象
    设计模式
    RESTful API规范
    Django中间件执行流程
  • 原文地址:https://www.cnblogs.com/feng9exe/p/8651005.html
Copyright © 2011-2022 走看看