Warning: file_get_contents(/data/phpspider/zhask/data//catemap/3/clojure/3.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181

Warning: file_get_contents(/data/phpspider/zhask/data//catemap/2/csharp/274.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Clojure core.async切换通道混合_Clojure_Core.async_Backpressure - Fatal编程技术网

Clojure core.async切换通道混合

Clojure core.async切换通道混合,clojure,core.async,backpressure,Clojure,Core.async,Backpressure,我正在试验core.async的混合。在混音中静音输入通道似乎是实现背压的可能方法之一。我使用的代码如下: (def output-chan (chan)) (def input-chan (chan)) (def mixer (admix (mix output-chan) input-chan)) (toggle mixer {input-chan {:mute true}}) 对REPL中的最后一行求值 CompilerException java.lang.IllegalArgumen

我正在试验core.async的混合。在混音中静音输入通道似乎是实现背压的可能方法之一。我使用的代码如下:

(def output-chan (chan))
(def input-chan (chan))
(def mixer (admix (mix output-chan) input-chan))
(toggle mixer {input-chan {:mute true}})
对REPL中的最后一行求值

CompilerException java.lang.IllegalArgumentException:未为类java.lang.Boolean实现协议的方法::toggle*。#'clojure.core.async/Mix

上面的示例代码有什么问题

谢谢

(def混合器(混合(混合输出通道)输入通道))

您可以将
admix
的返回值指定给
mixer
,它是一个布尔值,而不是预期的mixer。尝试:

(def output-chan (chan))
(def input-chan (chan))
(def mixer (mix output-chan))
(admix mixer input-chan)
(toggle mixer {input-chan {:mute true}})

非常感谢!我想我被混音器的易变性搞糊涂了。