我无法使用scalaz-stream实现以下功能:
echo '<script type="text/javascript">
var select = document.getElementById("group_1");
var option = select.getElementsByTagName("option");
for(j=0; j < option.length; j++){
option[j].removeAttribute("selected");
}
option['.$i.'].setAttribute("selected","selected");
select.onchange();
</script>';
我有一个尝试实现它的分支,但遗憾的是,即使在简单的情况下也是如此(如测试用例所示)。 scalaz-stream中/**
* Same as `merge` but is biased on the left side. Both `merge` and `mergeLeftBias` are
* non-deterministic, but `merge` tries to balance results from both to the extent the
* input streams are producing results at roughly the same speed. `mergeLeftBias`
* does not make any guarantees, but it will tend to grab elements from the left
* before the right. This is can be useful if, for instance, working with two streams
* that have interdependencies, i.e. the left stream produces results indirectly
* from the right stream being pulled from. This is a fairly common scenario that
* arises when using a `Queue` to merge "back" together a stream that was separated by
* some black box API that was not build over scalaz-stream.
*/
def mergeLeftBias[I]: Wye[I,I,I] = ???
的实现并不容易阅读(至少对我而言)。
https://github.com/jedesah/scalaz-stream/tree/topic/mergeLeftBiased