-
Notifications
You must be signed in to change notification settings - Fork 124
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
Macro question: Multiple value binding for local
#433
Comments
There's a few different problems with this. The first problem is that you're stepping thru the list one element at a time when you need to step two at a time. Also you're using The good news is you don't need a macro for this: (local (x y) (values 1 2)) It's already supported with regular Hope that helps. |
That works, but it's just a bit ugly once you get to (local (mod mapcan arr modified-arr)
(values
(require :mod)
mod.mapcan
[1 2 3 4]
(mapcan arr (fn (n) (* n 2))))) Again I don't really know why you'd have something like this with this example, |
Sure, once you get beyond 2 or 3 values it's awkward, but at that point there's no longer any reason to do it on one form; you might as well spread it out into multiple But if you really want to do it in a single form, you could write a macro that accepts your
The |
Alright good to know! Thanks for the answers! |
Hey, I saw you reopened this; is there still an open question here that needs further clarification? |
I was wondering if it work possible to create a way to do a multiple bind for
local
by creating a macro. Say it would be:However, I'm not entirely sure how to do this, as you'd have to do:
The initial way I thought you could do it would be:
However
symbol
will not be a symbol if you pass(local! x 1)
, it will be a number. As when you call the macro after creating it in a REPL:So how would one go about implementing this?
symbol
in the macro has to be a symbol and the name of that symbol is one that is passed.The text was updated successfully, but these errors were encountered: