Changeset 8157 in project


Ignore:
Timestamp:
02/05/08 18:57:36 (12 years ago)
Author:
Kon Lovett
Message:

Rmvd ##sys#hash prefix.

Location:
chicken/trunk
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • chicken/trunk/buildsvnrevision

    r8155 r8157  
    1 8154
     18156
  • chicken/trunk/extras.scm

    r8155 r8157  
    7474(private extras
    7575  reverse-string-append
    76   generic-write
     76  fprintf0 generic-write
    7777  unbound-value-thunk false-thunk
    7878  %number-hash %object-uid-hash %eq?-hash %eqv?-hash %equal?-hash
     79  %hash-table-ref %hash-table-update! %hash-table-for-each %hash-table-fold
    7980  hash-table-canonical-length hash-table-rehash )
    8081
    8182(declare
    8283  (hide
    83    fprintf0
    84     ##sys#hash-table-ref        ; shadows eval unit defines if not hidden
    85     ##sys#hash-table-update!
    86     ##sys#hash-table-for-each   ; shadows eval unit defines if not hidden
    87     ##sys#hash-table-fold
    88     generic-write
     84    fprintf0 generic-write
    8985    unbound-value-thunk false-thunk
    9086    %number-hash %object-uid-hash %eq?-hash %eqv?-hash %equal?-hash
     87    %hash-table-ref %hash-table-update! %hash-table-for-each %hash-table-fold
    9188    hash-table-canonical-length hash-table-rehash) )
    9289
     
    13731370                           (rec fstr lst) ) )
    13741371                        ((#\~) (##sys#write-char-0 #\~ out))
    1375                         ((#\%) (newline out))
    13761372                        ((#\% #\N) (newline out))
    13771373                        (else
     
    20662062;; Hash-Table Reference:
    20672063
    2068 (define ##sys#hash-table-ref
     2064(define %hash-table-ref
    20692065  (let ([core-eq? eq?])
    20702066    (lambda (ht key def)
     
    20992095     (##sys#check-structure ht 'hash-table 'hash-table-ref)
    21002096     (##sys#check-closure def 'hash-table-ref)
    2101      (apply ##sys#hash-table-ref ht key def) )
     2097     (apply %hash-table-ref ht key def) )
    21022098   hash-table-set!))
    21032099
    21042100(define (hash-table-ref/default ht key default)
    21052101  (##sys#check-structure ht 'hash-table 'hash-table-ref/default)
    2106   (##sys#hash-table-ref ht key (lambda () default)) )
     2102  (%hash-table-ref ht key (lambda () default)) )
    21072103
    21082104(define (hash-table-exists? ht key)
    21092105  (##sys#check-structure ht 'hash-table 'hash-table-exists?)
    2110   (not ($unbound? (##sys#hash-table-ref ht key unbound-value-thunk))) )
     2106  (not ($unbound? (%hash-table-ref ht key unbound-value-thunk))) )
    21112107
    21122108;; hash-table-update!:
     
    21302126            (loop (##sys#slot bucket 1)) ) ) ) ) ) )
    21312127
    2132 (define ##sys#hash-table-update!
     2128(define %hash-table-update!
    21332129  (let ([core-eq? eq?]
    21342130        [floor floor] )
     
    22022198  (##sys#check-closure func 'hash-table-update!)
    22032199  (##sys#check-closure thunk 'hash-table-update!)
    2204   (##sys#hash-table-update! ht key func thunk) )
     2200  (%hash-table-update! ht key func thunk) )
    22052201
    22062202(define (hash-table-update!/default ht key func def)
    22072203  (##sys#check-structure ht 'hash-table 'hash-table-update!/default)
    22082204  (##sys#check-closure func 'hash-table-update!/default)
    2209   (##sys#hash-table-update! ht key func (lambda () def)) )
     2205  (%hash-table-update! ht key func (lambda () def)) )
    22102206
    22112207(define (hash-table-set! ht key val)
    22122208  (##sys#check-structure ht 'hash-table 'hash-table-set!)
    22132209  (let ([val-thunk (lambda _ val)])
    2214     (##sys#hash-table-update! ht key val-thunk val-thunk) ) )
     2210    (%hash-table-update! ht key val-thunk val-thunk) ) )
    22152211
    22162212;; hash-table-delete!:
     
    22862282        (let* ([b (##sys#slot lst 0)]
    22872283               [val-thunk (lambda _ (##sys#slot b 1))] )
    2288           (##sys#hash-table-update! ht (##sys#slot b 0) val-thunk val-thunk) ) ) ) ) )
     2284          (%hash-table-update! ht (##sys#slot b 0) val-thunk val-thunk) ) ) ) ) )
    22892285
    22902286;; Hash-Table <-> Association-List:
     
    23112307        (for-each (lambda (x)
    23122308                    (let ([val-thunk (lambda _ (cdr x))])
    2313                       (##sys#hash-table-update! ht (car x) val-thunk val-thunk) ) )
     2309                      (%hash-table-update! ht (car x) val-thunk val-thunk) ) )
    23142310                  alist)
    23152311        ht ) ) ) )
     
    23542350;; hash-table-map:
    23552351
    2356 (define (##sys#hash-table-for-each ht proc)
     2352(define (%hash-table-for-each ht proc)
    23572353  (let* ([vec (##sys#slot ht 1)]
    23582354         [len (##sys#size vec)] )
     
    23632359                      (##sys#slot vec i)) ) ) )
    23642360
    2365 (define (##sys#hash-table-fold ht func init)
     2361(define (%hash-table-fold ht func init)
    23662362  (let* ([vec (##sys#slot ht 1)]
    23672363         [len (##sys#size vec)] )
     
    23772373                         (func (##sys#slot pare 0) (##sys#slot pare 1) acc) ) ) ) ) ) ) ) )
    23782374
    2379 (define (##sys#hash-table-map ht func)
    2380   (##sys#hash-table-fold ht (lambda (k v a) (cons (func k v) a)) '()) )
    2381 
    23822375(define (hash-table-fold ht func init)
    23832376  (##sys#check-structure ht 'hash-table 'hash-table-fold)
    23842377  (##sys#check-closure func 'hash-table-fold)
    2385   (##sys#hash-table-fold ht func init) )
     2378  (%hash-table-fold ht func init) )
    23862379
    23872380(define (hash-table-for-each ht proc)
    23882381  (##sys#check-structure ht 'hash-table 'hash-table-for-each)
    23892382  (##sys#check-closure proc 'hash-table-for-each)
    2390   (##sys#hash-table-for-each ht proc) )
     2383  (%hash-table-for-each ht proc) )
    23912384
    23922385(define (hash-table-walk ht proc)
    23932386  (##sys#check-structure ht 'hash-table 'hash-table-walk)
    23942387  (##sys#check-closure proc 'hash-table-walk)
    2395   (##sys#hash-table-for-each ht proc) )
     2388  (%hash-table-for-each ht proc) )
    23962389
    23972390(define (hash-table-map ht func)
    23982391  (##sys#check-structure ht 'hash-table 'hash-table-map)
    23992392  (##sys#check-closure func 'hash-table-map)
    2400   (##sys#hash-table-map ht func) )
     2393  (%hash-table-fold ht (lambda (k v a) (cons (func k v) a)) '()) )
    24012394
    24022395;; Done with Hash-Tables:
Note: See TracChangeset for help on using the changeset viewer.