有时我可以得到一个连接,有时它会失败
MongoDB shell version: 2.4.3
connecting to: test
Wed Jul 3 13:07:09.878 Socket recv() errno:104 Connection reset by peer 127.0.0.1:27017
Wed Jul 3 13:07:09.878 SocketException: remote: 127.0.0.1:27017 error: 9001 socket exception [1] server [127.0.0.1:27017]
Wed Jul 3 13:07:09.878 DBClientCursor::init call() failed
Wed Jul 3 13:07:09.880 JavaScript execution failed: Error: DBClientBase::findN: transport error: 127.0.0.1:27017 ns: admin.$cmd query: { whatsmyuri: 1 } at src/mongo/shell/mongo.js:L112
exception: connect failed
Run Code Online (Sandbox Code Playgroud) 这按预期工作
[97,98].map(function(x){String.fromCharCode(x)})
// [ 'a', 'b' ]
Run Code Online (Sandbox Code Playgroud)
但输出跟随线是意外的
[97,98].map(String.fromCharCode)
// [ 'a\u0000\u0000', 'b\u0001\u0000' ]
Run Code Online (Sandbox Code Playgroud) use
和 和有@before_compile
什么区别?两者都可用于将一些代码注入当前模块。
处理元组的方式似乎不一致:
defmodule A do
defmacro a(x) do
IO.inspect x
quote do end
end
end
Run Code Online (Sandbox Code Playgroud)
A.a {:a, :b}
版画{:a, :b}
不如预期,但A.a {:a}
打印{:{}, [line: 2], [:a]}
代码有什么问题吗?看起来binding
不适用iterate
?
(def ^:dynamic *step* 1) (defn incr [n] (+ n *step*)) (take 3 (binding [*step* 2] (iterate incr 1)))
给
'(1 2 3)
不
'(1 3 5)