Welcome to OGeek Q&A Community for programmer and developer-Open, Learning and Share
Welcome To Ask or Share your Answers For Others

Categories

0 votes
579 views
in Technique[技术] by (71.8m points)

lisp - operator #+ and #- in .sbclrc

Anybody know what #+ and #- operators means in .sbclrc? I couldn't find it in the manual. I see #- in .sbclrc after I installed quicklisp:

#-quicklisp
(let ((quicklisp-init (merge-pathnames "quicklisp/setup.lisp"
                                       (user-homedir-pathname))))
  (when (probe-file quicklisp-init)
    (load quicklisp-init)))

I also see #+ in the SBCL User Manual, but I couldn't find explanation of their functionality. Looks like something related for loading individual module.

Are they only for SBCL implementation or part of Common lisp?

See Question&Answers more detail:os

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome To Ask or Share your Answers For Others

1 Reply

0 votes
by (71.8m points)

That's a general facility of Common Lisp, not only SBCL.

There is a variable cl:*features* which lists symbols for 'features' which should be present in the Lisp system currently. Typical features are: endian, implementation, subsystems, processor, extensions, Lisp dialect and more.

In a Lisp file the expression #+quicklisp(foo) means: read and execute (foo) only if the feature quicklisp is present in the list of features *features*.

In a Lisp file the expression #-quicklisp(foo) means: read and execute (foo) only if the feature quicklisp is NOT present in the list of features *features*.

This facility is often used to hide or show implementation specific code to some other Common Lisp implementation.

See the documentation:

A typical extension is the feature-case reader macro.


与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
OGeek|极客中国-欢迎来到极客的世界,一个免费开放的程序员编程交流平台!开放,进步,分享!让技术改变生活,让极客改变未来! Welcome to OGeek Q&A Community for programmer and developer-Open, Learning and Share
Click Here to Ask a Question

...