What is the type of apostrophe in the scheme

I have a condition that uses a member function:

(cond ((member '1' (some-function)) (display #t)) (else (display #f)))

it works fine, but I still could not find the answers to:

1) what type is '1'?

2) I have the following expression

(lambda (x) (= x 1))

how can i convert to the same type '1'?

+4
source share
2 answers

Note that the expression conddoes not do what you think. What really happens:

(cond ((member '1 '(some-function))
       (display #t))
      (else
       (display #f)))

In other words: the number is 1quoted, and the expression is '(some-function)interpreted as a list of one element with a symbol some-functionas its only member. Regarding the first question, this expression:

'1'

... - , : 1, , , , , FYI , : "1". , :

'1
=> 1

:

(quote 1)
=> 1

, :

1
=> 1

, , , '1' , .

+5

'x (quote x). , . , , , :

(cond ((member '1 '(some-function)) (display #t)) (else (display #f)))

, . '1 1

+4

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


All Articles