Skip to content

Commit

Permalink
Add definition of symbol->string for r5rs that enforces immutability.
Browse files Browse the repository at this point in the history
Closes PR 6835.
  • Loading branch information
dyoo committed Feb 19, 2013
1 parent 87a5280 commit 65c8794
Showing 1 changed file with 11 additions and 3 deletions.
14 changes: 11 additions & 3 deletions collects/r5rs/main.rkt
Expand Up @@ -20,7 +20,8 @@
= < > <= >= max min + - * / = < > <= >= max min + - * /
abs gcd lcm exp log sin cos tan not eq? abs gcd lcm exp log sin cos tan not eq?
call-with-current-continuation make-string 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 exact->inexact inexact->exact number->string string->number
rationalize output-port? current-input-port current-output-port current-error-port rationalize output-port? current-input-port current-output-port current-error-port
open-input-file open-output-file close-input-port close-output-port open-input-file open-output-file close-input-port close-output-port
Expand Down Expand Up @@ -526,9 +527,16 @@
(syntax/loc stx (cond . rest)))])) (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] (rename-out [r5rs:quote quote]
[r5rs:quasiquote quasiquote] [r5rs:quasiquote quasiquote]
[r5rs:if if] [r5rs:if if]
Expand Down

0 comments on commit 65c8794

Please sign in to comment.