-
Notifications
You must be signed in to change notification settings - Fork 136
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
--case-> macro? #197
Comments
So if I understand it correctly, a more "proper" example could be (let ((options (list :reverse t :pop nil :double t)))
(--case-> (list 1 2 3)
((plist-get options :reverse) (nreverse it))
((plist-get options :pop) (pop it))
((plist-get options :double) (--map (* 2 it) it)))) ; => (6 4 2) Is this what you mean? I can see the usefulness but I'm thinking if it couldn't be solved in some other way already available. |
As for the implementation, you absolutely shouldn't need to use |
Haha, thanks. My experience writing macros is very limited. By the way, what made me think of it is this: https://github.com/alphapapa/mosey.el/blob/master/mosey.el#L150 Here I need to reverse the result if |
Does #349 satisfy this feature request? |
I'm still an elisp noob, so this is probably a bad idea and I just don't realize it yet. :) (I did search the issue tracker but I didn't find anything quite like this.)
What do you think about this macro?
Used like this:
I think it could be useful when handling option arguments to a function, where each option has the potential to mutate the result.
I thought that
-->
withwhen
would work, like this:But instead I get an error:
And I don't understand the macro expansion, which leaves out everything except the last form:
But even if that did work, having to write
(if COND FORM IT)
instead of(COND FORM)
is much more verbose, so it seems like(--case-> ...
could still be useful.There's also this one, which handles multiple forms:
Used like:
Thanks for your work on Dash.
The text was updated successfully, but these errors were encountered: