2016-01-23 41 views

回答

3

使用pkg/lib API:

#lang racket/base 

(require racket/format pkg/lib) 

(define (get-checksum str) 
    (define tbl (installed-pkg-table #:scope 'installation)) 
    (define info (hash-ref tbl str)) 
    (define chk (pkg-info-checksum info)) 
    (~a chk #:max-width 8)) 

然后,你可以做这样的事情:

(get-checksum "typed-racket") 
;; Returns: "f53314a2" for me, today