小编sur*_*nov的帖子

如何在Haskell中过滤无限列表

可能重复:
对无限列表的有限理解

我无法理解为什么ghci无法正确计算此代码?

[x | x <- [1..], x < 1000]
Run Code Online (Sandbox Code Playgroud)

Ghci只是停在最后一个号码,我需要在命令行中断这个过程以恢复正常状态.怎么了?我希望这段代码可以工作,因为haskell的懒惰评估.

haskell

13
推荐指数
2
解决办法
2965
查看次数

coffeescript安装

我无法在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)

macos shell install coffeescript

9
推荐指数
2
解决办法
8633
查看次数

使用http-server永久部署节点应用程序

我想使用http-server和forever.js将我的应用程序部署到远程ubuntu服务器.但forever.js需要JS文件的路径,而不是可执行文件.所以我无法将密钥传递给http-server.到目前为止,最好的解决方案是通过npm在本地安装http-server并运行如下:forever start ./node_modules/http-server/bin/http-server.但在这种情况下,我无法设置端口和其他选项.什么是最佳做法?

ubuntu daemon httpserver node.js

5
推荐指数
3
解决办法
6735
查看次数

数字划分的类型声明

我尝试了所有可能的类型声明,但我不能使这个代码甚至编译.诀窍是处理分裂的类型.我试过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)

haskell types sicp

1
推荐指数
1
解决办法
83
查看次数

标签 统计

haskell ×2

coffeescript ×1

daemon ×1

httpserver ×1

install ×1

macos ×1

node.js ×1

shell ×1

sicp ×1

types ×1

ubuntu ×1