1

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.

1 Answer 1

3

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"
1
  • 1
    ah, maybe i should have started at page 1 of the spec. :)
    – iKlsR
    Mar 18, 2013 at 16:18

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.