We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
1 parent ec99172 commit 1f82b74Copy full SHA for 1f82b74
xml/chapter4/section4/subsection4.xml
@@ -3183,9 +3183,23 @@ function unparse(exp) {
3183
}
3184
</JAVASCRIPT>
3185
<JAVASCRIPT_RUN>
3186
+function has_char(x, c) {
3187
+ let found = false;
3188
+ let i = 0;
3189
+ while (char_at(x, i) !== undefined) {
3190
+ found = found || char_at(x, i) === c;
3191
+ i = i + 1;
3192
+ }
3193
+ return found;
3194
+}
3195
+function better_stringify(x) {
3196
+ return is_string(x) && ! has_char(x, "'")
3197
+ ? "'" + x + "'"
3198
+ : stringify(x);
3199
3200
function unparse(exp) {
3201
return is_literal(exp)
- ? stringify(literal_value(exp))
3202
+ ? better_stringify(literal_value(exp))
3203
: is_name(exp)
3204
? symbol_of_name(exp)
3205
: is_list_construction(exp)
0 commit comments