Reputation: 1218
How to get the compiler used in common lisp?
example imaginary:
(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))))
Upvotes: 3
Views: 186
Reputation: 27424
You can use lisp-implementation-type
(see the manual):
CL-USER> (lisp-implementation-type)
"SBCL"
or
CL-USER> (lisp-implementation-type)
"Clozure Common Lisp"
Note that the function returns the name of the implementation, which is not necessarily a compiler. Some Common Lisp implementations can include an interpreter, a compiler, a translator to another programming language, etc.
Upvotes: 7