可能重复:
对无限列表的有限理解
我无法理解为什么ghci无法正确计算此代码?
[x | x <- [1..], x < 1000]
Run Code Online (Sandbox Code Playgroud)
Ghci只是停在最后一个号码,我需要在命令行中断这个过程以恢复正常状态.怎么了?我希望这段代码可以工作,因为haskell的懒惰评估.
我无法在Macbook上安装CoffeeScript.相同的命令在我的iMac上运行正常.
$ surganov:~ surganov$ sudo npm install coffee-script -g
npm http GET https://registry.npmjs.org/coffee-script
npm http 304 https://registry.npmjs.org/coffee-script
/usr/local/share/npm/bin/coffee -> /usr/local/share/npm/lib/node_modules/coffee-script/bin/coffee
/usr/local/share/npm/bin/cake -> /usr/local/share/npm/lib/node_modules/coffee-script/bin/cake
coffee-script@1.3.3 /usr/local/share/npm/lib/node_modules/coffee-script
$ surganov:~ surganov$ coffee
-bash: coffee: command not found
Run Code Online (Sandbox Code Playgroud) 我想使用http-server和forever.js将我的应用程序部署到远程ubuntu服务器.但forever.js需要JS文件的路径,而不是可执行文件.所以我无法将密钥传递给http-server.到目前为止,最好的解决方案是通过npm在本地安装http-server并运行如下:forever start ./node_modules/http-server/bin/http-server.但在这种情况下,我无法设置端口和其他选项.什么是最佳做法?
我尝试了所有可能的类型声明,但我不能使这个代码甚至编译.诀窍是处理分裂的类型.我试过Num a,Fractional a,Float a等.
cube x = x * x * x
sum' term a next b =
if a > b
then 0
else term a + sum' term (next a) next b
integral f a b n = (h / 3) * (sum' term 0 succ n) where
h = (b - a) / n
y k = f $ a + (k * h)
term k
| k == 0 || …Run Code Online (Sandbox Code Playgroud)