What is ' (apostrophe) in Lisp / Scheme?

后端 未结 7 667
情深已故
情深已故 2021-02-01 12:16

I am on day 1 hour 1 of teaching myself Scheme. Needless to say, I don\'t understand anything. So I\'m reading The Little Schemer and using this thing:

7条回答
  •  逝去的感伤
    2021-02-01 12:32

    The single-quote character is shorthand way of saying (quote foo) where quote is the form to return just foo without evaluating it.

    One thing to really remember in Scheme or any Lisp for that matter is that everything is evaluated by default. So, in cases where you don't want to evaluate you need a way to sat this.

    Quoting something does just this and the single-quote is just requires less typing and leads to less verbose code.

提交回复
热议问题