小编z_a*_*xis的帖子

cabal不能卸载包吗?

cabal help 显示thers不是"卸载"选项.

那么卸载cabal安装的软件包的最佳方法是什么?

% cabal update
% cabal install mighttpd2
Run Code Online (Sandbox Code Playgroud)

mighttpd2已成功安装.但是ghc-pkg无法找到并取消注册:

% ghc-pkg list | grep -i might
% ghc-pkg unregister mighttpd2
ghc-pkg: cannot find package mighttpd2 
Run Code Online (Sandbox Code Playgroud)

祝商祺!

>find .cabal | grep -i mighttp
.cabal/share/doc/mighttpd2-2.3.3
.cabal/share/doc/mighttpd2-2.3.3/LICENSE
.cabal/share/mighttpd2-2.3.3
.cabal/share/mighttpd2-2.3.3/sample.conf
.cabal/share/mighttpd2-2.3.3/sample.route
.cabal/packages/hackage.haskell.org/mighttpd2
.cabal/packages/hackage.haskell.org/mighttpd2/2.3.3
.cabal/packages/hackage.haskell.org/mighttpd2/2.3.3/mighttpd2-2.3.3.tar.gz

>ghc-pkg list | grep -i package\.conf
 /usr/local/lib/ghc-7.0.3/package.conf.d:
 /home/sw2wolf/.ghc/i386-freebsd-7.0.3/package.conf.d:
Run Code Online (Sandbox Code Playgroud)

所以ghc-pkg无法看到".cabal/packages/hackage.haskell.org".

haskell

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

clisp中atoi的相应标准功能是什么?

在visual lisp中,您可以使用(atoi "123")转换"123"123.在clisp中似乎没有"atoi"这样的功能?

任何建议表示赞赏!


现在我想转换'(1 2 3 20 30)"1 2 3 20 30",那么最好的方法是什么?

parse-interger可以将字符串转换为整数,以及如何将整数转换为字符串?我需要使用format功能吗?

(map 'list #'(lambda (x) (format nil "~D" x)) '(1 2 3)) => ("1" "2" "3")
Run Code Online (Sandbox Code Playgroud)

但是我不知道如何将它变为"1 2 3"像haskell那样:

concat $ intersperse " " ["1","2","3","4","5"] => "1 2 3 4 5"
Run Code Online (Sandbox Code Playgroud)

祝商祺!

lisp clisp common-lisp

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

关于"topfind"?

当我#use "topfind" ;;手动输入顶级时,它的工作原理如下:

 #use "topfind" ;;
 - : unit = ()
 Findlib has been successfully loaded. Additional directives:
 #require "package";;      to load a package
 #list;;                   to list the available packages
 #camlp4o;;                to load camlp4 (standard syntax)
 #camlp4r;;                to load camlp4 (revised syntax)
 #predicates "p,q,...";;   to set these predicates
 Topfind.reset();;         to force that packages will be reloaded
 #thread;;                 to enable threads #use "topfind" ;;
  - : unit = ()
Run Code Online (Sandbox Code Playgroud)

然而,当我把#use "topfind";;~/.ocamlinit文件中,这是行不通的:

>cat ~/.ocamlinit
#use "topfind";; …
Run Code Online (Sandbox Code Playgroud)

ocaml

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

使用异常来突破文件行的迭代

有些文本文件需要逐行操作.我写了一个withFile函数如下:

let withFile fn handle =
    let rec iter_lines fh =
    try
        handle (input_line fh);
        iter_lines fh
    with _ -> close_in fh in
    iter_lines (open_in fn);;
Run Code Online (Sandbox Code Playgroud)

所以我可以将每个文件操作为:

withFile "file1.txt" (fun line -> (*...*))
withFile "file2.txt" (fun line -> (*...*))
...
Run Code Online (Sandbox Code Playgroud)

但是当我不想处理所有线路时,我不确定如何优雅地退出.例如:

withFile "file3.txt" (fun line ->
   (*when the line meets some condition, i will exit without handling other lines*)
);
Run Code Online (Sandbox Code Playgroud)

任何建议表示赞赏!

ocaml exception

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

为什么Ocsigen不能运行我的python文件?

配置文件test.conf如下:

<ocsigen>
<server>
<port>*:8000</port>

<logdir>/home/zaxis/tmp/log/</logdir>
<datadir>/home/zaxis/tmp/data</datadir>
<user>zaxis</user>
<group>wheel</group>
<charset>utf-8</charset>
......
<extension findlib-package="ocsigen_ext.cgimod">
  <cgitimeout value="30"/>
</extension>

<extension findlib-package="ocsigen_ext.staticmod"/>
......
<site path="qachina" charset="utf-8">
    <cgi root="cgi-bin" dir="/media/E/www/qachina/cgi-bin"/>
    <static dir="/media/E/www/qachina" />
</site>
....
<commandpipe>/home/zaxis/tmp/ocsigen_command</commandpipe>
</server>
</ocsigen>
Run Code Online (Sandbox Code Playgroud)

然后我运行Ocsigen:

ocsigeocsigen -c test.conf

我可以访问http://127.0.0.1:8000/qachina/index.htm.但是,Ocsigen不会在cgi-bin中执行我的python脚本,但希望浏览器下载它.

顺便说一句,所有python脚本文件都可以直接在shell中运行.

>head cgi-bin/nav.py
#!/usr/bin/env python
# -*- coding: utf-8 -*-enter code here
...
Run Code Online (Sandbox Code Playgroud)

我无法访问Ocsigen的邮件列表,所以我在这里发帖寻求建议.

ocaml ocsigen

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

为什么CCL无法加载hunchentoot?

SBCL可以成功加载hunchentoot.然而,CCL报道:

? (ql:quickload :hunchentoot)
To load "hunchentoot":
Load 1 ASDF system:
hunchentoot
; Loading "hunchentoot"
> Error: Unable to load any of the alternatives:
>           ("libssl.so.0.9.8" "libssl.so" "libssl.so.4")
> While executing: CFFI::FL-ERROR, in process listener(1).
> Type :POP to abort, :R for a list of available restarts.
> Type :? for other options.nter code here
Run Code Online (Sandbox Code Playgroud)

任何建议表示赞赏!

hunchentoot ccl

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

任何Haskell Web服务器都可以运行Python CGI应用程序吗?

我需要一个使用Haskell开发的Web服务器来运行旧的Python CGI应用程序.

任何建议表示赞赏!

haskell happstack yesod haskell-snap-framework

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

如何实现"appendFile"功能?

我可以使用以下函数来覆盖文本文件:

let writeFile ~filename:fn s =
let oc = open_out fn in
    output_string oc s;
    close_out oc ;;
Run Code Online (Sandbox Code Playgroud)

但是,我不知道如何在文本文件中附加一行?

ocaml

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

如何在Common Lisp中调用此函数?

(defun (setf xwin-border-width) (width win)
    (setf (xlib:drawable-border-width win) width))
Run Code Online (Sandbox Code Playgroud)

那么如何调用上面的函数呢?事实上,我真的不明白"(setf xwin-border-width)"代替功能时间是什么意思?

真诚的!

common-lisp

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

执行"cabal install hoogle"时出错

当我跑步时cabal install hoogle,我得到以下内容:

setup: The program happy version >=1.17 is required but it could not be found
cabal: Error: some packages failed to install
haskell-src-exts-1.13.3 failed during the configure step the exeption is ExitFailure 1

$ghc -V
The Glorious Glasgow Haskell Compilation System, version 7.4.1
Run Code Online (Sandbox Code Playgroud)

如何解决这样的问题?

haskell ghc cabal

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