是否可以强迫Clojure使用原始类型而不是盒装版本?
我有以下代码示例:
(type (apply / [5.0 0]))
它引发了意外的错误 - “按零”(预期行为:返回INF)
可能是由于自动盒引起的 - 可以防止它吗?
I have a following sample of code:
(type (apply / [5.0 0]))
It throws an unexpected error - "Division By Zero" (expected behavior: return Inf)
Probably, it happens due to auto-boxing - can it be prevented?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
假设您只想在双打上使用两个参数部门,则以下可能有效。
如果您走这条路径,请查看
clj-cmmons/rigitive-Math
。Assuming you just want to use a two argument division on doubles, the following might work.
If you go down this path, check out
clj-cmmons/primitive-math
.我不知道
应用
在Clojure中以这种不同的方式行事。How about
I didn't know that
apply
behaves in such a different manner in Clojure.