知识卡片
柯里化显式传入参数
柯里化将一次收多个参数的函数改成多层各收一个参数的函数。部分应用是实际先传入一部分值,得到等待剩余参数的函数。传给声明式宏的函数名只是一段令牌,无法据此得知有几个参数。闭包写法 |a, b| a + b 给出名字和数量,宏可展开为 move |a| move |b| a + b。
相关卡片 [[相邻类型约束函数组合]]。
这张卡片看不懂?
这张卡片已通过人工审查,不再接受失败反馈。
已有反馈 · 0 条
还没有人提交反馈。
在整书笔记中的位置
- · 柯里化与卫生性
原书出处 · 1 处
- Declarative macros 柯里化与卫生性 · 查看原书依据
You would soon discover that currying with declarative macros is harder, though. One problem is the lack of “visibility” of the function’s signature: what does it require as parameters, and what does it return?
参考来源
- 位置:《Write Powerful Rust Macros》第02章《Declarative macros》(book-source:extracted/Write Powerful Rust Macros/_epub-src/OEBPS/Text/chapter-2.xhtml#p146)
- 结论依据:柯里化段比较函数名缺少签名和闭包显式提交语法的输入差异。
- 原始内容:You would soon discover that currying with declarative macros is harder, though. One problem is the lack of “visibility” of the function’s signature: what does it require as parameters, and what does it return?