Quote Unquote01 Mar 2014
Most functional languages are great in treating/presenting everything as data.
Elixir is no less, it has power to present anything into data using its powerfull
Lets look at what quote does to executables. In essence it differs the execution and present that executable in data form(abstract syntax tree). Lets dive
All expressions are represented as three element tuple. Here as we can see, first element
<> is function or operation that is to be performed, second one is metadat related to, in this case it defines that
<> is an
Kernal function and third element contains argument passed.
Now to execute this quoted representation, we need to eval it, here is how
Now we will make this example more complex
Why? because quoted representation or abstract sysntax tree need hard values not references, as it packages away all stuff for latter execution. So in this case it can not evaluate list.
To overcome this
elixir provides us awesome
unquote. Let’s see it in action
Happy Coding :)