Why is CLISP an unnecessary No notation?

I am learning Lisp from Practical General Lisp. At some point, I should enter the following bit of code:

[1] (remove-if-not #'evenp '(1 2 3 4 5 6 7 8 9 10))
(2 4 6 8 10)

I assume the idea here, of course, is that remove-if-not wants a function that can return T or NIL when given an argument, and that function then applies to all characters in the list, returning a list containing only those characters where he returned NIL.

However, if I write the following code in CLISP now:

[2] (remove-if-not 'evenp '(1 2 3 4 5 6 7 8 9 10)
(2 4 6 8 10)

It still works! So my question is, does the question of whether I use a notation with a sharp quote or just use a quote sufficient is relevant? Now it seems that the extra sharp is only there so that the programmer knows that "Hey, this is a function, not just some random character!" - but if he has any other use, I would like to know about it.

I am using GNU CLISP 2.49 (2010-07-07, sheesh, which is actually pretty old).

+4
source share
3 answers

Sharp-quote and quote do not have the same behavior in the general case:

(defun test () 'red)

(flet ((test () 'green))
  (list (funcall 'test)
        (funcall #'test))) => (red green)

(.. symbol-function). , , , . , , . , .

. , , , , , .

+12

CLISP, Common Lisp ( Clozure Common Lisp).

, , symbol-function ( , ) :

? #'evenp
#<Compiled-function EVENP #x3000000F2D4F>
? (symbol-function 'evenp)
#<Compiled-function EVENP #x3000000F2D4F>

, , , . (#' (function)), - , ; , , . , .

+5

( ) funcall et. . , , . , , , ; , .

, # 'X readtime (- x) ' x (quote x). .

? , , , - F . , Pew Research 98,3% Lisp , 62,3% , .

.

'(lambda (..)...) vs. # '( (..)...). , , eval, .. . v.s. , .. , .

0

Source: https://habr.com/ru/post/1524105/


All Articles