The study of Higher-order function in Python(20170913)
来源:互联网 发布:倚天行情软件下载 编辑:程序博客网 时间:2024/05/16 17:42
The study of Higher-order function in Python(20170913)
the variable can point to the function
print(abs) #
f = abs
print(f) #
print(f(-2)) # the variable point to the function abs()
# now f is amount to the abs(), this is a function f()
the function name is also a variable name
that means the functional name is just a variable name
which is point to the function
Afferent function(传入参数)
一个函数可以接收另一个函数作为参数,这种函数就称之为高阶函数
def fun1(x,y,fun):
return fun(x) + fun(y)
print(fun1(-9,-8,abs))
编写高阶函数,就是让函数的参数能够接收别的函数
把函数作为参数传入,这样的函数称为高阶函数,函数式编程就是指这种高度抽象的编程范式。
阅读全文
0 0
- The study of Higher-order function in Python(20170913)
- The study of map() and reduce() function in Python(20170913)
- The study of parameter of function in Python(20170908)
- The study of recursive function in Python(20170910)
- python higher-order function demo
- The study of how to define a function in Python(20170907)
- The study of loop in Python(20170906)
- The study of slice in Python(20170911)
- The study of literation in Python(20170911)
- The study of generator in Python(20170912)
- the argument of function in python
- Python基础-高阶函数-Higher-order function
- higher-order function first-order function
- The study of calling fuction in Python(20170907)
- The study of List Comprehensions in Python(20170911)
- The study of iterator in Python(20170912)
- The study of Class and Instance in Python(20170918)
- The study of access restriction in Python(20170920) 访问限制
- 创建型模式之工厂模式
- Linux运维之网络文件系统NFS介绍与部署(CentOS 7.2版本)
- 读书笔记-07随需而变:网站的可扩展架构
- iOS中JS与原生OC互相调用之问题总结二
- Didn't find class "com.google.firebase.provider.FirebaseInitProvider"
- The study of Higher-order function in Python(20170913)
- c++ 插入迭代器
- 数据结构和算法--二叉树的实现
- 总结 2017.9.13
- Java连接MnogoDb数据库
- iOS 单例设计模式 单例写法
- 绝对大佬的模板%%%
- iOS SDK的设计与实现
- js arguments关键字和callee