type
status
date
slug
summary
tags
category
icon
password
Property
Jul 13, 2023 01:59 PM

Higher Order Functions

notion image
notion image
函数作为一等公民,意味着他们可以像操作值一样

Designing Functions

notion image
notion image
函数的域是它可能作为参数的所有输入的集合。
函数的范围是它可能返回的一组输出值。
纯函数的行为是它在输入和输出之间创建的关系。
 
notion image
保持纯洁和不要重复dry

Generalization

notion image
notion image
notion image
 
/Higher Order Functions
notion image
函数之间的共同结构可能是一个计算过程,而不是一个数字。
notion image
notion image
notion image
notion image
Functions as Return Values
notion image
notion image
就是js中的闭包
 
notion image
 
notion image
notion image
operand 操作
notion image
notion image
the parent frame is always where the function is defined。parent frame 总是定义函数的时候就确定了
notion image
Self Reference
notion image
notion image
notion image
print_sums(1) first operator
notion image
notion image
notion image
next_sum 多次调用,就是parent frame的不同,然后n也不同
notion image
函数的多次调用,每次都会生成新的函数,因此函数的内存地址是不一样的
命令行会显示返回的函数的地址,但是直接执行py文件不会,除非你调用print函数
notion image
CS 61A(Part 6) - RecursionCS 61 A (Part 4) - Environment Diagrams
  • Waline
Kitety
Kitety
独特为佳
公告
我曾经七次鄙视自己的灵魂
--卡里·纪伯伦
第一次,当它本可进取时,却故作谦卑;
第二次,当它在空虚时,用爱欲来填充;
第三次,在困难和容易之间,它选择了容易;
第四次,它犯了错,却借由别人也会犯错来宽慰自己;
第五次,它自由软弱,却把它认为是生命的坚韧;
第六次,当它鄙夷一张丑恶的嘴脸时,却不知那正是自己面具中的一副;
第七次,它侧身于生活的污泥中,虽不甘心,却又畏首畏尾。
 
最新评论
Loading...