I want pass a conditional statement within a function but not its evaluation result.
age(name, age, :age > 10)
def age(name, age, condition) do
I need to get the AST of the condition but right now it gives
It seems you should use
defmacro and not
Silly question, you dont want to pass a function? e.g.
age(name, age, fn age -> age > 10 end)
defmacro seems like a better option but i am not able to handle them in unit tests. If i have multiple tests and i want to run a single test then it runs all the macros called in all tests.
i don’t know if can convert the lambda function to AST.
Not sure you need to convert a closure to AST. You can just make your code accept a closure (lambda) and not do macro magic.