What is ' (apostrophe) in Racket?

前端 未结 2 746
旧时难觅i
旧时难觅i 2021-01-14 07:50

I am a little confused about the meaning of the \' sign in racket. It appears to me that the same sign has different meanings. Look at 2 simple examples below:<

2条回答
  •  爱一瞬间的悲伤
    2021-01-14 08:56

    You are confused by the default way of #lang racket of printing values, which differs from almost all the other interactive lisp environments. If you choose in DrRacket itself another language, for instance R5RS, you will discover that it prints:

    > (list 1 2 3 4)
    (1 2 3 4)
    

    that is, the result of the operator list applied to the numbers 1 2 3 4 is to produce a list of those numbers, which is exactly the interpretation of (1 2 3 4).

    So, the answer to What is ' (apostrophe) in Lisp / Scheme? is valid also for your case, and 'anything is just an abbreviation for (quote anything).

提交回复
热议问题