Clojure core.async切换通道混合
我正在试验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
(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}})
非常感谢!我想我被混音器的易变性搞糊涂了。