Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Browse files

Add definition of symbol->string for r5rs that enforces immutability.

Closes PR 6835.
  • Loading branch information...
commit 65c8794532ae60a5feffa5c47e3e6e58973a7037 1 parent 87a5280
@dyoo authored
Showing with 11 additions and 3 deletions.
  1. +11 −3 collects/r5rs/main.rkt
View
14 collects/r5rs/main.rkt
@@ -20,7 +20,8 @@
= < > <= >= max min + - * /
abs gcd lcm exp log sin cos tan not eq?
call-with-current-continuation make-string
- symbol->string string->symbol make-rectangular
+ (rename-out [r5rs:symbol->string symbol->string])
+ string->symbol make-rectangular
exact->inexact inexact->exact number->string string->number
rationalize output-port? current-input-port current-output-port current-error-port
open-input-file open-output-file close-input-port close-output-port
@@ -526,9 +527,16 @@
(syntax/loc stx (cond . rest)))]))
- (define-syntax-rule (mk-undefined id) undefined)
+ (define-syntax-rule (mk-undefined id) undefined)
- (provide unquote unquote-splicing
+ ;; r5rs:symbol->string: symbol ->string
+ ;; r5rs defines symbol->string to produce immutable strings.
+ (define (r5rs:symbol->string s)
+ (unless (symbol? s)
+ (raise-type-error 'symbol->string "symbol" s))
+ (string->immutable-string (symbol->string s)))
+
+ (provide unquote unquote-splicing
(rename-out [r5rs:quote quote]
[r5rs:quasiquote quasiquote]
[r5rs:if if]
Please sign in to comment.
Something went wrong with that request. Please try again.