macro-stepper: simplified partition code
original commit: e9a8e92585e029410245f30c218ce8cbebe15fb3
This commit is contained in:
parent
fc8ab37c3f
commit
ddc9d3e953
|
@ -83,22 +83,16 @@
|
||||||
;; simplified : hash[(listof nat) => nat]
|
;; simplified : hash[(listof nat) => nat]
|
||||||
(define simplified (make-hash))
|
(define simplified (make-hash))
|
||||||
|
|
||||||
;; unsimplified : hash[(listof nat) => nat]
|
|
||||||
(define unsimplified (make-hash))
|
|
||||||
|
|
||||||
;; next-number : nat
|
;; next-number : nat
|
||||||
(define next-number 0)
|
(define next-number 0)
|
||||||
|
|
||||||
(define/public (get-partition stx)
|
(define/public (get-partition stx)
|
||||||
(let ([umarks (get-marks stx)])
|
(let ([marks (simplify-marks (get-marks stx))])
|
||||||
(or (hash-ref unsimplified umarks #f)
|
(or (hash-ref simplified marks #f)
|
||||||
(let ([smarks (simplify-marks umarks)])
|
(let ([n next-number])
|
||||||
(or (hash-ref simplified smarks #f)
|
(hash-set! simplified marks n)
|
||||||
(let ([n next-number])
|
(set! next-number (add1 n))
|
||||||
(hash-set! simplified smarks n)
|
n))))
|
||||||
(hash-set! unsimplified umarks n)
|
|
||||||
(set! next-number (add1 n))
|
|
||||||
n))))))
|
|
||||||
|
|
||||||
(define/public (same-partition? a b)
|
(define/public (same-partition? a b)
|
||||||
(= (get-partition a) (get-partition b)))
|
(= (get-partition a) (get-partition b)))
|
||||||
|
|
Loading…
Reference in New Issue
Block a user