Sorry all I am saying the creator of db/private/mysql/connection.rkt didn't anticipate your needs and kept the function private.
If you want to submit a pull request to move this function to db or db/base (including an appropriate provide), please do so. On Jun 11, 2013, at 4:41 PM, David Vanderson wrote: > On 06/11/2013 04:33 PM, Matthias Felleisen wrote: >> >> db/private/mysql/connection.rkt does not export the function, otherwise you >> could. > I don't understand this. I'd like to make the function available to users > somewhere - are you saying that's bad? >> >> >> On Jun 11, 2013, at 4:26 PM, David Vanderson wrote: >> >>> Thank you Stephen and Tony for your examples. I found the following >>> private function in db/private/mysql/connection.rkt: >>> >>> (define (hex-string->bytes s) >>> (define (hex-digit->int c) >>> (let ([c (char->integer c)]) >>> (cond [(<= (char->integer #\0) c (char->integer #\9)) >>> (- c (char->integer #\0))] >>> [(<= (char->integer #\a) c (char->integer #\f)) >>> (+ 10 (- c (char->integer #\a)))] >>> [(<= (char->integer #\A) c (char->integer #\F)) >>> (+ 10 (- c (char->integer #\A)))]))) >>> (unless (and (string? s) (even? (string-length s)) >>> (regexp-match? #rx"[0-9a-zA-Z]*" s)) >>> (raise-type-error 'hex-string->bytes >>> "string containing an even number of hexadecimal >>> digits" s)) >>> (let* ([c (quotient (string-length s) 2)] >>> [b (make-bytes c)]) >>> (for ([i (in-range c)]) >>> (let ([high (hex-digit->int (string-ref s (+ i i)))] >>> [low (hex-digit->int (string-ref s (+ i i 1)))]) >>> (bytes-set! b i (+ (arithmetic-shift high 4) low)))) >>> b)) >>> >>> >>> Can this function be exported? I'm willing to make a patch with docs and >>> tests - is file/sha1 the right place? >>> >>> Thanks, >>> Dave >>> >>> _________________________ >>> Racket Developers list: >>> http://lists.racket-lang.org/dev >> > _________________________ Racket Developers list: http://lists.racket-lang.org/dev