'(quote quote) in scheme

前端 未结 2 1893
隐瞒了意图╮
隐瞒了意图╮ 2021-01-20 11:21

I\'m trying to learn scheme by myself. Could anyone tell me why \'(quote quote) will output \'quote, and \'(quote \'quote) will output

2条回答
  •  情书的邮戳
    2021-01-20 11:55

    This expression:

    '(quote quote)
    

    ... after expanding ' to (quote ) is equivalent to (quote (quote quote)), notice that the symbol quote is being quoted two times, and this expression is evaluated and printed as ''quote.

    On the other hand, this expression:

    '(quote 'quote)
    

    ... is equivalent to (quote (quote (quote quote))), notice that the symbol quote is being quoted three times, and this expression is evaluated and printed as '''quote.

提交回复
热议问题