简体   繁体   中英

Elixir Macros: convert atoms into vars

I want to create an Elixir macro that converts a list of atoms [:a, :b] to vars a, b. The value of a and b can be anything -- all that I want to achieve is creating a variable with the readable name of the atom passed in. Is this possible? If so, how?

这可以使用Macro.var/1

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM