Reputation: 2672
Why does (quote '"foo")
go through the Scheme interpreter? It should be syntactically redundant or wrong based on how expressions are constructed in Scheme. quote
is used whenever one wants to use a symbol without Scheme thinking it's a variable and strings aren't valid symbols so why is the abbreviation for the quote
operator valid when prefixed to strings? Oddly enough (quote '"foo")
returns (quote "foo")
. Redundancy?
Another strange experiment (symbol? '"foo")
is evaluated to #f
so that proves that quoted strings still aren't symbols (if the quote works that way in a statement). So, is the '
ignored on strings or does it serve some purpose elsewhere? I am using Chicken Scheme.
Somewhat trivial but kinda mind boggling at the same time.
Upvotes: 1
Views: 282
Reputation: 235984
As stated in the specification:
(quote <datum>)
evaluates to the datum value represented by (see section 4.3). This notation is used to include constants.
The above doesn't exclude the quotation of strings, in fact one of the examples in that section is this one:
'"abc" => "abc"
It follows that this is also valid:
''"abc" => ''"abc"
Upvotes: 3