Re: [racket-users] Re: Is there a way to format keys/values like raise-arguments-error

2021-09-10 Thread David Storrs
On Fri, Sep 10, 2021 at 1:33 PM kamist...@gmail.com wrote: > I like the apply max instead of foldl, quite a bit easier. > > Instead of `(format "\t~a" (~a (~a k #:width width) v #:separator "\t"))` > I prefer one of these: > (~a "\t" (~a k #:width width) "\t" v) > (~a #:separator "\t" "" (~a k

Re: [racket-users] Re: Is there a way to format keys/values like raise-arguments-error

2021-09-10 Thread kamist...@gmail.com
I like the apply max instead of foldl, quite a bit easier. Instead of `(format "\t~a" (~a (~a k #:width width) v #:separator "\t"))` I prefer one of these: (~a "\t" (~a k #:width width) "\t" v) (~a #:separator "\t" "" (~a k #:width width) v) -- You received this message because you are

Re: [racket-users] Re: Is there a way to format keys/values like raise-arguments-error

2021-09-10 Thread David Storrs
Wow, thank you Simon. That was above and beyond. I should have thought of ~a to start with. With your pointers I came up with a less flexible solution that is sufficient to the current issue: #lang racket/base (require racket/format racket/string) (define my-keys '("bacon" "eggs"

[racket-users] Re: Is there a way to format keys/values like raise-arguments-error

2021-09-09 Thread kamist...@gmail.com
I am not really aware of a function that does this you could try digging into the implementation of raise-arguments-error, usually I roll my own implementation depending on what I really want to output. racket/format and its ~a, ~v, etc. have a lot of useful optional keyword arguments like