Hi folks,

I'm having trouble understanding the docs on hash contracts (
https://docs.racket-lang.org/reference/data-structure-contracts.html#%28def._%28%28lib._racket%2Fcontract%2Fprivate%2Fhash..rkt%29._hash%2Fc%29%29
)

What I'm trying to express is:

- This function returns #t because it is a simple test function intended to
get the hang of hash contracts...
- This function takes one argument...
- Which is a hash...
- Which has keys 'success, 'file-id, 'scratchdir-path, and 'chunk-hash...
- All of which are symbols...
- The values will be, respectively:
success boolean?
file-id (or/c #f exact-positive-integer?)
scratchdir-path path-string?
chunk-hash string?

My first attempt was:

(define/contract (x h)
  (-> (hash/dc [file-id symbol?]          [a (file-id) (or/c #f
exact-positive-integer?)]
               [scratchdir-path symbol?]  [b (scratchdir-path) path-string?]
               [chunk-hash symbol?]       [c (chunk-hash) string?]
               [success symbol?]          [d (success) boolean?])
      #t)
  #t)


My second attempt was:
(define/contract (x h)
  (-> (hash/dc [file-id symbol?
                        scratchdir-path symbol?
                        chunk-hash symbol?
                        success symbol?]
               [a (file-id) (or/c #f exact-positive-integer?)
                b (scratchdir-path) path-string?
                c (chunk-hash) string?
                d (success) boolean?])
      #t)
  #t)

Both of these have syntax issues and I can't make heads or tails of the
docs.  Help, please?

-- 
You received this message because you are subscribed to the Google Groups 
"Racket Users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to racket-users+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to