mirror of
https://github.com/jbranchaud/til
synced 2026-01-03 23:28:02 +00:00
Add Expose Internal Representation as an elixir til
This commit is contained in:
16
elixir/expose-internal-representation.md
Normal file
16
elixir/expose-internal-representation.md
Normal file
@@ -0,0 +1,16 @@
|
||||
# Expose Internal Representation
|
||||
|
||||
Elixir is a language that has strong support for metaprogramming. It
|
||||
provides easy access to an internal representation of the code in the form
|
||||
of an Abstract Syntax Tree (AST) using maps and keyword lists. The `quote`
|
||||
function is used to expose this internal representation.
|
||||
|
||||
```elixir
|
||||
> quote do: 2 * 2
|
||||
{:*, [context: Elixir, import: Kernel], [2, 2]}
|
||||
> quote do: 2 * 2 == 4
|
||||
{:==, [context: Elixir, import: Kernel],
|
||||
[{:*, [context: Elixir, import: Kernel], [2, 2]}, 4]}
|
||||
```
|
||||
|
||||
[source](http://elixir-lang.org/getting-started/meta/quote-and-unquote.html)
|
||||
Reference in New Issue
Block a user