Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Common Lisp: What does #+nil?

Tags:

common-lisp

The other day (perhaps yesterday) I was quite perplexed about this #+nil read-time conditional found in https://github.com/billstclair/defperson/blob/master/defperson.lisp#L289.

After some deep thinking I came to the conclusion that this is very lispy way of commenting out code. Can someone confirm this?

Perhaps my assumptions are completely wrong. Anyway, thanks in advance.

like image 442
rudolfo.christ Avatar asked Apr 24 '15 14:04

rudolfo.christ


People also ask

What does Common Lisp provide?

Common Lisp is extensible through standard features such as Lisp macros (code transformations) and reader macros (input parsers for characters). Common Lisp provides partial backwards compatibility with Maclisp and John McCarthy's original Lisp. This allows older Lisp software to be ported to Common Lisp.

Is Common Lisp interpreted?

Traditionally, LISP can be interpreted or compiled -- with some of each running at the same time. Compilation, in some cases, would be to a virtual machine like JAVA. LISP is a general purpose programming language, but rarely used as such anymore.


1 Answers

Yes, it is a lispy way of commenting code, but you shouldn't leave this out in production code.

A better alternative is #+(or).

It only takes one more character, it takes the same key presses if you use Emacs paredit or some other mode that automatically inserts the closing parenthesis, and it's not subject to the existence of the symbol :nil in *features*.

like image 188
acelent Avatar answered Oct 20 '22 03:10

acelent