gpt4 book ai didi

lisp - 在 clozure common lisp 中读取错误

转载 作者:太空宇宙 更新时间:2023-11-03 18:59:08 26 4
gpt4 key购买 nike

有一个 s-expressions 文件,其中包括外语字符,我正在按如下方式读取它:

(defun test (file)
(with-open-file (stream file)
(loop while (read stream nil nil))))

它在ccl 1.8中读取文件没有错误,但在1.9下抛出错误:

? (test "/users/markklein/desktop/naples.text")
> Error: Reader error: Illegal symbol syntax.
> While executing: CCL::%PARSE-TOKEN, in process Listener(5).
> Type cmd-. to abort, cmd-\ for a list of available restarts.
> Type :? for other options.
1 >

有没有人知道出了什么问题,以及如何解决?我可以根据要求发送数据文件。

最佳答案

Ben Hyde 在 a comment 中提到那R. Matthew Emerson在 Clozure 邮件列表上谈到了这个问题,指出 Clozure CL 的默认外部格式已更改为 :utf-8。因此,他提出了这个替代方案:

We changed the default external format to :utf-8 in the 1.9 release. This is probably tripping you up. Try specifying an appropriate external-format explicitly, e.g.,

(defun test (file)
(with-open-file (stream file :external-format :iso-8859-1)
(loop while (read stream nil nil))))

关于lisp - 在 clozure common lisp 中读取错误,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/24254678/

26 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com