如何在常见的lisp中使用编译器?
例子虚构:
(defun get-compiler ()
(RETURN-COMPILER-NAME))
(defun some-factory ()
(cond ((string= (get-compiler) "SBCL") (some))
((string= (get-compiler) "CMU") (some))
((string= (get-compiler) "MCL") (some))
((string= (get-compiler) "EXCL") (some))))
Run Code Online (Sandbox Code Playgroud)
你可以使用lisp-implementation-type
(参见手册):
CL-USER> (lisp-implementation-type)
"SBCL"
Run Code Online (Sandbox Code Playgroud)
要么
CL-USER> (lisp-implementation-type)
"Clozure Common Lisp"
Run Code Online (Sandbox Code Playgroud)
请注意,该函数返回实现的名称,该名称不一定是编译器.一些Common Lisp实现可以包括解释器,编译器,到另一种编程语言的翻译器等.
归档时间: |
|
查看次数: |
64 次 |
最近记录: |