-
-
Notifications
You must be signed in to change notification settings - Fork 648
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
add keyword-apply/dict to racket/dict #2592
Conversation
In the same spirit as |
@sorawee That seems reasonable but also a little dangerous, since the static keywords could overlap with the dynamic ones. Example: @AlexKnauth The (keyword-apply/dict
some-keyword-function
'((#:color . "red") (#:color . "green"))
'()) I think a naive implementation of |
I think that |
@sorawee It does support @jackfirth |
ca690d8
to
950c13b
Compare
69f6a74
to
ed659b6
Compare
@sorawee I have now documented that |
@jackfirth I have updated the error message, to be about
|
|
||
@defproc[ | ||
(keyword-apply/dict [proc procedure?] | ||
[kw-dict (dict/c keyword? any/c)] |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
What is dict/c
? I searched and only found one from mischief
which I don't think is what you want.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Oh, I had assumed (dict/c keyword? any/c)
was like (hash/c keyword? any/c)
, but for generic dicts and not just hash tables. But I suppose if it doesn't exist, maybe just dict?
should go there? Although I would prefer it to say the keys must be keywords... would (and/c dict? (compose (listof keyword?) dict-keys))
work better? Kinda long though.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Okay, I've changed it to dict?
for now
Is it okay if I try to copy the implementation of |
I think that should be a separate PR. Maybe just use |
This needs some tests, and a history note. Also, I'm not sure that the |
18a11e9
to
254050d
Compare
Perhaps |
Currently If so then |
Yeah, that dependency will definitely slow down startup time a bit. Following is the result of running
And here are ones that use
|
I'm fine with leaving it in [Aside: the |
I have added some tests in |
Can this be merged by 7.9 release? |
f7cc91e
to
9f4fa5b
Compare
The last review mentioned 3 things: tests, a history note, and placement. I have added tests and a history note, and we agreed on placement in |
* add keyword-apply/dict to racket/dict * add history note
* add keyword-apply/dict to racket/dict * add history note
See #2548. The
keyword-apply/dict
function is a variation onkeyword-apply
that solves two problems: