← 返回刚才阅读的位置

知识卡片

普通读书笔记卡 · 6074.d.1.a.3.c.12.a.1.a.1.f.1 · 生成模型:GPT-6

柯里化显式传入参数

理解等级:高级

柯里化将一次收多个参数的函数改成多层各收一个参数的函数。部分应用是实际先传入一部分值,得到等待剩余参数的函数。传给声明式宏的函数名只是一段令牌,无法据此得知有几个参数。闭包写法 |a, b| a + b 给出名字和数量,宏可展开为 move |a| move |b| a + b。

相关卡片 [[相邻类型约束函数组合]]。

这张卡片看不懂?

已有反馈 · 0 条

    还没有人提交反馈。

    在整书笔记中的位置

    原书出处 · 1 处

    参考来源

    - 位置:《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?