-
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
Destructive versions of threading macros #300
Comments
Here are some of my implementations. They seem trivial. If you're interested in this idea and want me to make a formal pull request let me know and I'll do so. (defmacro ->* (x &rest forms)
`(setq ,x (-> ,x ,@forms)))
(defmacro ->>* (x &rest forms)
`(setq ,x (->> ,x ,@forms)))
(defmacro -->* (x &rest forms)
`(setq ,x (--> ,x ,@forms))) |
Why not use |
I tried
and I get |
On Tue, 13 Aug 2019 23:20:30 +0800, Matus Goljer wrote:
[1 <text/plain; UTF-8 (7bit)>]
[2 <text/html; UTF-8 (7bit)>]
I tried
(let (var)
(cl-callf '->> var 1 (* 2) (+ 1))
var)
and I get Debugger entered--Lisp error: (invalid-function '->>)
―
You are receiving this because you commented.
Reply to this email directly, view it on GitHub, or mute the thread.
(cl-callf '->> var (* 2) (+ 1)) is wrong usage, you should use
(let ((var 1)) (cl-callf ->> var (* 2) (+ 1)))
|
I see, yes that works. I like it. |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Very often I want to update the value of a variable using a threading macro.
So often in fact that the
setq cute-var
var is beginning to feel tedious and unnecessary. I suspect I'm not the only one. Perhaps creating destructive versions of these macros would be helpful. What do you think?The text was updated successfully, but these errors were encountered: