Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

What does #+#. mean in lisp?

Tags:

It is almost impossible to google, hence my understanding is limited to contextual clues from reading through the slime source code: perhaps it is part of the object system in common lisp? Something like 'self'?

snippet:

(cond #+#.(swank-backend::sbcl-with-new-stepper-p) 

Perhaps this will make it more googleable : pound plus pound // hash plus hash symbol // octothorp plus octothorp

like image 221
Tim Hanson Avatar asked Apr 26 '11 03:04

Tim Hanson


People also ask

What does the fox say Meaning?

Speaking of the meaning of the song, Vegard characterizes it as coming from "a genuine wonder of what the fox says, because we didn't know". Although interpreted by some commentators as a reference to the furry fandom, the brothers have stated they did not know about its existence when producing "The Fox".

What does a real fox say?

One of the most common fox vocalizations is a raspy bark. Scientists believe foxes use this barking sound to identify themselves and communicate with other foxes. Another eerie fox vocalization is a type of high-pitched howl that's almost like a scream.

How can I identify a song by sound?

On your phone, touch and hold the Home button or say "Hey Google." Ask "What's this song?" Play a song or hum, whistle, or sing the melody of a song. Hum, whistle, or sing: Google Assistant will identify potential matches for the song.


1 Answers

That's pretty rare to see.

#+clim clim:+red+ #-clim mygraphics:+red+ 

above means that the reader returns either red symbol and it depends whether there is a symbol with the name CLIM is on the list of features *features*. That's a built-in mechanism in Common Lisp.

#.(cl:if (cl:zerop (cl:random 2)) :high :low) 

Above also is a mechanism of the reader. It allows to do computations at read time. Which btw. is a security problem and in Lisp applications it should be disabled - see the variable *read-eval* for controlling this. At read time the reader using READ will return either :HIGH or :LOW, randomly.

The combination #+#.(FOO) BAR means that the function foo returns a symbol at read time and this symbol then is checked by the reader if there is a symbol with this name on the feature list *features* and if that is the case, then the next item in input is read, otherwise the next item is skipped over.

Trivial example, IF always returns :CAPI in this example:

In LispWorks (where CAPI is on the features list):

CL-USER 41 > (read-from-string "#+#.(cl:if cl:t :capi :clim) a b") A 31 

In SBCL

* (read-from-string "#+#.(cl:if cl:t :capi :clim) a b")  B 32 
like image 85
Rainer Joswig Avatar answered Sep 18 '22 18:09

Rainer Joswig