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

Using pcase in ->> macro #374

Open
yyoncho opened this issue Mar 2, 2021 · 0 comments
Open

Using pcase in ->> macro #374

yyoncho opened this issue Mar 2, 2021 · 0 comments
Labels
enhancement Suggestion to improve or extend existing behavior

Comments

@yyoncho
Copy link
Contributor

yyoncho commented Mar 2, 2021

We had some conversations about the ability to plug pcase into ->> macro(the alternative is using generic -shift-args which will allow using ->> with any function that will require)

(defmacro ->>pcase (&rest rest)
  (declare (indent 0) (debug t))
  `(pcase ,@(-rotate 1 rest)))

(->> (list 1 2 3)
     (-filter #'evenp)
     (->>pcase
       (`() (user-error "Nothing found"))
       (`(,spec) spec)
       (_ (user-error "More than one")))
     (number-to-string))

I know that one can use --> but the ability to plug conditional check in the ->> seems to be very handy.

What do maintainers think about having such functionality?

@basil-conto basil-conto added the enhancement Suggestion to improve or extend existing behavior label Mar 2, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement Suggestion to improve or extend existing behavior
Projects
None yet
Development

No branches or pull requests

2 participants