Move list-set and list-update to unstable/list.

original commit: 6e2e84664da60e82434f907d7274fcc88e47e11f
This commit is contained in:
Eric Dobson 2012-08-11 23:10:31 -07:00 committed by Sam Tobin-Hochstadt
parent 2117167e8b
commit 26b3938743
3 changed files with 2 additions and 24 deletions

View File

@ -360,14 +360,4 @@
(provide/cond-contract (struct Rep ([seq exact-nonnegative-integer?]
[free-vars (hash/c symbol? variance?)]
[free-idxs (hash/c symbol? variance?)]
[stx (or/c #f syntax?)]))
[replace-syntax (Rep? syntax? . -> . Rep?)])
(define (replace-field val new-val idx)
(define-values (type skipped) (struct-info val))
(define maker (struct-type-make-constructor type))
(define flds (struct->list val))
(apply maker (list-set flds idx new-val)))
(define (replace-syntax rep stx)
(replace-field rep stx 3))
[stx (or/c #f syntax?)])))

View File

@ -13,6 +13,7 @@
env? update-type/lexical env-map env-props replace-props)
racket/contract racket/match
unstable/struct
unstable/list
"tc-metafunctions.rkt"
(for-syntax racket/base))

View File

@ -9,9 +9,6 @@ at least theoretically.
racket/require-syntax racket/provide-syntax
racket/struct-info "timing.rkt")
;; to move to unstable
(provide list-update list-set)
(provide
;; optimization
optimize?
@ -157,16 +154,6 @@ at least theoretically.
[(_ hd ([i c] ...) . opts)
(define-struct hd (i ...) . opts)])))
(define (list-update l i f)
(cond [(null? l) (error 'list-update "list not long enough" l i f)]
[(zero? i) (cons (f (car l)) (cdr l))]
[else (cons (car l) (list-update (cdr l) (sub1 i) f))]))
(define (list-set l k v)
(if (zero? k)
(cons v (cdr l))
(cons (car l) (list-set (cdr l) (sub1 k) v))))
(provide make-struct-info-self-ctor)
;Copied from racket/private/define-struct