Function contracts for multiple return values

It appears Sorawee's solution works perfectly. The contract is for a class method; hence, the entry for this. I'm very impressed with Racket's contract system!

[ get-user-data
  (->i ([ _             any/c       ] ; this
        [ conn          connection? ]
        [ reference-key string?     ]
        [ type          string?     ])
       (values [ hsh (or/c hash? #f) ]
               [ errors (hsh) (if (hash? hsh)
                                  '()
                                  (listof string?)) ])) ]

P.S. It looks like someone may have marked the previous reply solved prematurely, maybe an admin/moderator? May I humbly suggest we wait a period of time to allow the OP to mark a solution before doing so on their behalf? I was busy yesterday evening, so I was only able to test the solution today.

1 Like