quoting parameter and not prefab structs
This commit is contained in:
parent
1f084da620
commit
893294674a
|
@ -425,13 +425,17 @@
|
||||||
(define (or-pred? v . ps)
|
(define (or-pred? v . ps)
|
||||||
(ormap (lambda (?) (? v)) ps))
|
(ormap (lambda (?) (? v)) ps))
|
||||||
|
|
||||||
|
|
||||||
|
(define quoting? (make-parameter #f))
|
||||||
|
|
||||||
(define (shareable? v)
|
(define (shareable? v)
|
||||||
(not (or-pred? v char? maybe-same-as-fixnum? empty? boolean? void?)))
|
(not (or quoting? (or-pred? v char? maybe-same-as-fixnum? empty? boolean? void?))))
|
||||||
|
|
||||||
(define (maybe-same-as-fixnum? v)
|
(define (maybe-same-as-fixnum? v)
|
||||||
(and (exact-integer? v)
|
(and (exact-integer? v)
|
||||||
(and (v . >= . -1073741824) (v . <= . 1073741823))))
|
(and (v . >= . -1073741824) (v . <= . 1073741823))))
|
||||||
|
|
||||||
|
|
||||||
(define (out-anything v out)
|
(define (out-anything v out)
|
||||||
(out-shared
|
(out-shared
|
||||||
v out
|
v out
|
||||||
|
@ -771,7 +775,8 @@
|
||||||
[else
|
[else
|
||||||
(out-byte CPT_QUOTE out)
|
(out-byte CPT_QUOTE out)
|
||||||
(if (quoted? v)
|
(if (quoted? v)
|
||||||
(out-anything (quoted-v v) out)
|
(parameterize ([quoting? #t])
|
||||||
|
(out-anything (quoted-v v) out))
|
||||||
(let ([s (open-output-bytes)])
|
(let ([s (open-output-bytes)])
|
||||||
(parameterize ([pretty-print-size-hook
|
(parameterize ([pretty-print-size-hook
|
||||||
(lambda (v mode port)
|
(lambda (v mode port)
|
||||||
|
|
|
@ -22,7 +22,7 @@
|
||||||
|
|
||||||
(define-syntax-rule (define-form-struct* id id+par ([field-id field-contract] ...))
|
(define-syntax-rule (define-form-struct* id id+par ([field-id field-contract] ...))
|
||||||
(begin
|
(begin
|
||||||
(define-struct id+par (field-id ...) #:prefab)
|
(define-struct id+par (field-id ...))
|
||||||
#;(provide (struct-out id))
|
#;(provide (struct-out id))
|
||||||
(provide/contract
|
(provide/contract
|
||||||
[struct id ([field-id field-contract] ...)])))
|
[struct id ([field-id field-contract] ...)])))
|
||||||
|
|
Loading…
Reference in New Issue
Block a user