我想做一些模拟,ACT-R我需要一个Common Lisp实现.我有三种Common Lisp可用的实现:(1) CLISP [1],(2) ECL [1]和(3) SBCL [1].正如您可能从链接中收集的那样,我已经在维基百科上阅读了所有这三个链接.但我想要一些有经验的用户的意见.更具体地说,我想知道:
(i) 这三种实现之间的主要区别是什么(例如:它们最擅长的是什么?它们中的任何一种仅用于特定目的,因此可能不适用于特定任务吗?)?
(ii)基于我将使用的事实ACT-R还是基于一般原因,是否有明显的选择?
由于这可以解释为一个主观问题我检查了我在这里可以问什么主题以及我应该避免询问哪些类型的问题?如果我读得正确,它不应该被视为禁果.
我最近发现了Iphone的Lisp,想找一些代码示例.
https://github.com/TerjeNorderhaug/ecl-iphone-builder/#readme
我有以下包定义.如何递归编译所有组件,以及它们与C源的依赖关系?换句话说,我想保留构建本机可执行文件的所有 C文件.
目前,我使用(asdf:make-build :example但不会留下任何C文件.
我期待着看到
simple.c
simple.h
simple.data
cl-opengl.c
cl-opengl.h
...
Run Code Online (Sandbox Code Playgroud)
example.asd:
(defsystem :example
:depends-on (:cl-opengl :cl-glu :cl-glut)
:serial t
:components ((:file "simple")))
Run Code Online (Sandbox Code Playgroud)
CL-opengl.asd:
(defsystem cl-opengl
:description "Common Lisp bindings to OpenGL."
:depends-on (cffi alexandria)
:components
((:module "gl"
:components
((:file "bindings-package")
(:file "constants" :depends-on ("bindings-package"))
(:file "library" :depends-on ("bindings-package"))
(:file "bindings" :depends-on ("bindings-package" "constants" "library"))
...
Run Code Online (Sandbox Code Playgroud) 我试图使用ECL创建一个.o文件,目的是使用其编译为C的功能,但是在尝试按文档列表构建程序时收到错误消息。
我在跑步:
(c:build-program "CompiledFile" "hello.lisp")
Run Code Online (Sandbox Code Playgroud)
收到错误:
Debugger received error of type: SIMPLE-ERROR
Cannot find the external symbol BUILD-PROGRAM in #<"C" package>.
Error flushed.
>> "CompiledFile"
>> "hello.lisp"
>> ;;; Warning: Ignoring an unmatched right parenthesis.
Run Code Online (Sandbox Code Playgroud)
hello.lisp的内容如下:
(defun say-hello ()
(print "Hello, world"))
(say-hello)
(terpri)
(quit)
Run Code Online (Sandbox Code Playgroud)
我正在这里https://common-lisp.net/project/ecl/static/manual/ch34s03.html找到的文档,其功能定义为:
c:build-program {image-name &key lisp-files ld-flags prologue-code epilogue-code}
我是lisp的初学者并且有一个问题.当我直接在REPL中编写一些代码(没有任何.lisp文件!)时,如何保存解释器的工作/状态以便下次恢复并继续工作?
(我正在使用ECL)
感谢名单!抱歉我的英语不好;)
在emacs中,我希望打开多个shell,输入一次命令,并让它在每个shell中运行 - 类似于multixterm(http://freecode.com/projects/multixterm)的方式.
问题听起来微不足道,但经过一段时间查看ECL文档,CFFI文档并诉诸谷歌,我仍然无法得出明确的答案.ECL文档没有提到回调语法,CFFI文档没有提到关于ECL中回调的任何实现限制,并且我无法将google提示的页面转换为逻辑.
我正试图进入嵌入在C++中的Common Lisp的迷人世界.我的问题是我无法从c ++中读取和打印由ECL中定义的lisp函数返回的字符串.
在C++中,我有这个函数来运行任意的Lisp表达式:
cl_object lisp(const std::string & call) {
return cl_safe_eval(c_string_to_object(call.c_str()), Cnil, Cnil);
}
Run Code Online (Sandbox Code Playgroud)
我可以用这种方式用数字来做:
ECL:
(defun return-a-number () 5.2)
Run Code Online (Sandbox Code Playgroud)
用C++读取和打印:
auto x = ecl_to_float(lisp("(return-a-number)"));
std::cout << "The number is " << x << std::endl;
Run Code Online (Sandbox Code Playgroud)
一切都设置好并且工作正常,但我不知道用字符串而不是数字来做.这是我尝试过的:
ECL:
(defun return-a-string () "Hello")
Run Code Online (Sandbox Code Playgroud)
C++:
cl_object y = lisp("(return-a-string)");
std::cout << "A string: " << y << std::endl;
Run Code Online (Sandbox Code Playgroud)
打印字符串的结果是这样的:
一个字符串:0x3188b00
我猜是字符串的地址.
这是捕获调试器和y cl_object 的内容.y-> string.self类型是一个ecl_character.
我已经尝试过这个示例ECL存储库asdf示例,它工作正常,但它没有任何asdf依赖项.如果我添加
:依赖(#:inferior-shell)
到example.asd然后运行已编译的独立可执行文件会出现此错误:
Condition of type: SIMPLE-PACKAGE-ERROR
There exists no package with name "ASDF/DRIVER"
No restarts available.
Run Code Online (Sandbox Code Playgroud)
导致此错误的原因是什么,以及在ECL上处理asdf依赖项的惯用方法是什么?
如何从调用返回字符串常量ffi:c-inline?
我已经尝试了以下变体而没有成功(ORGANIZATION是constants.h中定义的常量):
(ffi:clines "#include \"./constants.h\"")
(ffi:c-inline () () :string "ORGANIZATION" :one-liner t)
Run Code Online (Sandbox Code Playgroud)
上面的示例导致以下编译器错误:
未知的表示类型:STRING