Skip to content
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

:map :key-order request: #281

Closed
riotrah opened this issue Dec 9, 2022 · 2 comments
Closed

:map :key-order request: #281

riotrah opened this issue Dec 9, 2022 · 2 comments

Comments

@riotrah
Copy link

riotrah commented Dec 9, 2022

Hey again,

I love to be able to sort maps. However, sometimes I want the inverse of :map {:key-order ...} - I want to specify which keys come last.

I propose two options:

  1. another option like :key-order-inverse or something
  2. a slightly modified api altogether:
    3. support more flexible ordering a la storybook's approach here (or at least a certain subset of it)
    4. like so: [:first :second "*" :penultimate :last]
    5. Where "*" is some special token or symbol of your choosing, string or otherwise
    6. this way, depending on your special token of choice, we can maintain compatibility, and still keep one :key-order config option

What do you think?

@kkinnear
Copy link
Owner

This seems like a reasonable request, and I like your idea of an extended API that maintains compatibility a lot. Thanks for bringing that up! I'm currently pressing to get the latest release finished up and out, but I will definitely add this to the list for the next release. I seems like a good idea!

@kkinnear
Copy link
Owner

Implemented this in the just released 1.2.6. Instead of your good suggestion of "*" as a token to separate beginning from ending keys, I decided to use :| instead. I hope this feature works out for you.

Thanks for asking for this feature. It has not been clear to me how many people use zprint at the REPL. It is nice to know somebody does!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants