add 'simple-root' for students to use in test suites that call gc:cons
This commit is contained in:
parent
c1bfc9601e
commit
b047b32c6e
|
@ -98,7 +98,13 @@
|
||||||
(provide/contract
|
(provide/contract
|
||||||
[root? (-> any/c boolean?)]
|
[root? (-> any/c boolean?)]
|
||||||
[root-name (-> root? any/c)]
|
[root-name (-> root? any/c)]
|
||||||
[make-root (-> any/c (-> location?) (-> location? void) root?)])
|
[make-root (-> any/c (-> location?) (-> location? void) root?)]
|
||||||
|
[simple-root (-> location? root?)])
|
||||||
|
|
||||||
|
(define (simple-root n)
|
||||||
|
(make-root 'simple-root
|
||||||
|
(λ () n)
|
||||||
|
(λ (n2) (set! n n2))))
|
||||||
|
|
||||||
(provide make-env-root)
|
(provide make-env-root)
|
||||||
(define-syntax (make-env-root stx)
|
(define-syntax (make-env-root stx)
|
||||||
|
|
|
@ -96,6 +96,10 @@ Determines if @racket[v] is a root.
|
||||||
Updates @racket[root] to refer to @racket[loc].
|
Updates @racket[root] to refer to @racket[loc].
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@defproc[(simple-root [l location?]) root?]{
|
||||||
|
Makes a root that is initialized with @racket[l].
|
||||||
|
}
|
||||||
|
|
||||||
@defproc[(make-root [name symbol?] [get (-> location?)] [set (-> location? void?)])
|
@defproc[(make-root [name symbol?] [get (-> location?)] [set (-> location? void?)])
|
||||||
root?]{
|
root?]{
|
||||||
Creates a new root. When @racket[read-root] is called, it invokes
|
Creates a new root. When @racket[read-root] is called, it invokes
|
||||||
|
|
Loading…
Reference in New Issue
Block a user