Scheme is a beautiful language. – prof Ben Leong
Recently I read some Scheme articles and I find myself start appreciating more about its beauty. I am going to start a series of posts to share my thoughts and problems I had in learning.
Any technology sufficiently advanced is indistinguishable from magic. – Arthur C. Clarke
Converts scheme code into data.
|‘(1 (2 3))||[list] ([integer] 1, [list]([integer] 2, [integer] 3))|
|‘’(1 2)||[list] ([symbol] quote, [list]([integer] 1, [integer] 2))|
''(1 2)is actually
(quote (quote (1 2))), which converts
Scheme without “quote” is still Turing complete. I think the main reason for introducing “quote” is macros, which makes scheme flexible and extensible.
Symbol seems to be the same as interned string. However, we cannot replace symbol with string because
'define will be not distinguishable. To make
'define meaningful, a new first class type has to be introduced, and that is symbol. Note that introducing symbol data type does not add any syntax to scheme.
'define is just syntactical sugar for
(quote define). This may sounds hacky, but it worth it because it gives scheme the power to process code in the same way it process lists. We will see more about this in another post about macros.