Scala:咖喱与闭合
作者:Mandroid 提问时间:11/29/2020
我可以使用闭包来定义这样的函数: def product(x: Int) = (y: Int) => x * y val productBy3 = product(3) println(produc...
咖喱 问答列表
作者:Mandroid 提问时间:11/29/2020
我可以使用闭包来定义这样的函数: def product(x: Int) = (y: Int) => x * y val productBy3 = product(3) println(produc...
作者:Enlico 提问时间:4/3/2023
是否可以通过协程实现函数咖喱?你会怎么做? 通常,如果我需要咖喱函数,我会使用 boost::hana::curry,就像这样,但我很好奇 C++20 的协程是否也可以执行相同的任务。...
作者:Tando 提问时间:4/29/2023
如果您考虑作为 的初始值设定项,您不应该使它们松散耦合并 DI 初始值设定项(或任何其他方式),尤其是当您需要多个初始值设定项时?还是我误解了 FP 中咖喱函数的基本概念?inner_multiply...
作者:Vivek 提问时间:5/10/2023
这次我正在尝试在 PHP 中实现 currying(就像我们在 Javascript 中所做的那样)。以下是我的代码,它不起作用: <?php function test(callable $fn...
作者:lands 提问时间:7/4/2023
/** * @type T Represents the type of the incoming function * @type First Represents the parameters...
作者:wonderful world 提问时间:7/4/2023
我已经使用了一段时间,并试图理解用于创建选择器的功能语言功能或设计模式,如本 NgRx 文档页面上所述。来自面向对象编程的背景,看到许多函数而不是采用一堆属性的简单调用让我感到困惑。NgRx 使用什...
作者:Homo Civicus 提问时间:7/31/2023
所以我有一个函数来讨好其他函数: const curry = <TArg, TReturn>(fn: (...args: TArg[]) => TReturn) => { const currie...
作者:PengHX 提问时间:8/21/2023
我现在正在学习Haskell,我只是对此感到非常好奇。 例如: minus :: Int -> Int -> Int -> Int minus x y z = x - y - z 如果我想先将 ...
作者:Jim Bollinger 提问时间:10/22/2023
我正在尝试为类方法创建一个可调用的变量。 class Person { method walk(Str $direction) { say "Walking $direction"; } } ...
作者:Spencer Carney 提问时间:11/3/2023
我正在尝试创建 Lodash 的 curried 函数。mapValues const curried = curryRight<{ foo: string }, { foo: boolean }>...