*> sin sin 0.5
<interactive>:10:1:
Non type-variable argument in the constraint: Floating (a -> a)
(Use FlexibleContexts to permit this)
When checking that ‘it’ has the inferred type
it :: forall a. (Floating a, Floating (a -> a)) => a
Run Code Online (Sandbox Code Playgroud)
但sin (sin 0.5)有效.
我认为它们是相同的,我无法理解错误信息.
我想知道为什么?
该join()方法等待线程终止。它用来wait执行此操作。
if (millis == 0) {
while (isAlive()) {
wait(0);
}
}
Run Code Online (Sandbox Code Playgroud)
那么当线程退出时,如何通知wait set中的线程呢?
我尝试在JDK源代码中查找代码,但失败了。谁能告诉我相关的代码片段吗?
当一个线程处于等待状态时,它可能会isAlive()多次检查其时间片,这是浪费吗?
如果isAlive()为 false,则返回,该线程已处于等待集中。有while(isAlive())必要吗?
在 GHCI 中,我得到以下结果:
div (-7) ( 2) = -4
div ( 7) (-2) = -4
div (-7) (-2) = 3
mod ( 7) ( 2) = 1
mod ( 7) (-2) = -1
mod (-7) ( 2) = 1
mod (-7) (-2) = -1
Run Code Online (Sandbox Code Playgroud)
并且div 4 (-3)是-2并且mod 4 (-3)是-2。
我无法理解如何获得这些结果。有什么法律或规则吗?什么是正确的计算步骤?