Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

What's "|...|" stand for?

Tags:

common-lisp

What's the meaning of :|temp files| in the following code snippet?

(defmethod acceptor-remove-session ((acceptor my-site-acceptor) (session t))
    (declare (ignore acceptor))
    (loop for path in (session-value :|temp files|)
     do
         (ignore-errors (delete-file path))))
like image 916
z_axis Avatar asked Mar 01 '12 02:03

z_axis


People also ask

What is stand for meaning?

The ideas or attitudes that someone or something stands for are the ones that they support or represent. The party is trying to give the impression that it alone stands for democracy. [ VERB PARTICLE noun] He hates us and everything we stand for. [ VERB PARTICLE noun]

What is the meaning of this symbol &?

The ampersand, also known as the and sign, is the logogram &, representing the conjunction "and". It originated as a ligature of the letters et—Latin for "and".


2 Answers

In Common Lisp, |...| may be used to quote characters in a symbol name; it may escape ordinarily disallowed characters such as spaces, and it also disables case conversion.

  • foo or :foo have the symbol-name of "FOO"
  • |temp files| or :|temp files| have the symbol-name of "temp files"
  • || is named "", the empty string, which is otherwise impossible to produce

(The colon here has the usual meaning of a keyword symbol (a symbol in the KEYWORD package) and is independent of the bars.)

|...| is useful when a task lends itself to the use of symbols, but not ones named according to Common Lisp conventions. I would imagine in this case the text "temp files" occurs in the program's output somewhere, or is used for a filename, or some other case where seeing TEMP-FILES would be annoying.

like image 117
Kevin Reid Avatar answered Oct 01 '22 03:10

Kevin Reid


| is a multiple escape character in Common Lisp symbols:

? 'aaBBcc|DDeeFFgg|hhII|jjKK|LL

-> |AABBCCDDeeFFggHHIIjjKKLL|

The vertical bar does not need to surround the whole symbol name. It can also escape parts of the symbol.

like image 33
Rainer Joswig Avatar answered Oct 01 '22 01:10

Rainer Joswig