# Fun with Metaprogramming

**URL:** <https://forum.elixirforum.com/t/fun-with-metaprogramming/6987>\
**Category:** Discussions\
**Tags:** macros\
**Created:** [July 18, 2017, 8:28pm UTC](https://forum.elixirforum.com/t/fun-with-metaprogramming/6987 "2017-07-18T20:28:30Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![Qqwy](https://forum.elixirforum.com/user_avatar/forum.elixirforum.com/qqwy/32/1349_2.png) [@Qqwy](https://forum.elixirforum.com/u/Qqwy)\
**Post date:** [July 18, 2017, 8:28pm UTC](https://forum.elixirforum.com/t/fun-with-metaprogramming/6987/1 "2017-07-18T20:28:30Z")

</div>

Recently I found out that you can get rather creative with Elixir’s metaprogramming as its AST lets itself be bent into some fancy shapes.

**Use this stuff at your own peril! Don’t say I did not warn you. Your coworkers might lynch you.. 😈 .**

[Ampersands](https://gist.github.com/Qqwy/79960701a31bbe75d44fc018b2ffdea1)

```elixir
iex> use AtAt
iex> @@@@@@@@@@@@@@@@@@@@@@@self()
"Wow! Running self() with 23 ats!"
#PID<0.85.0>

```

[Exclamation Marks](https://gist.github.com/Qqwy/519888d8ee6d3529251aeb188398091d):

```elixir
iex(56)> import Scream

iex(58)> scream!! 42
"You say: 42."
iex(59)> scream!!!!!!!!!!!!!! 'I like trains and I cannot lie'
"You scream: 'I like trains and I cannot lie'!!"

```

Yes, these are definitely small party tricks, but I had to giggle a little, so I wanted to share these with you because maybe they make someone else giggle as well.  
And who knows, maybe they can serve as some kind of inspiration to someone… 👼

Do you guys know any other ways in which Elixir’s AST can be ~~mis~~ used?

---

<div class="post-metadata">

**Author:** ![OvermindDL1](https://forum.elixirforum.com/user_avatar/forum.elixirforum.com/overminddl1/32/2677_2.png) [@OvermindDL1](https://forum.elixirforum.com/u/OvermindDL1)\
**Post date:** [July 18, 2017, 10:50pm UTC](https://forum.elixirforum.com/t/fun-with-metaprogramming/6987/2 "2017-07-18T22:50:23Z")

</div>

> [@Qqwy](#):
>
> Do you guys know any other ways in which Elixir’s AST can be misused?

Hmm, my MLElixir project is a great big AST hack. ^.^

---

<div class="post-metadata">

**Author:** ![cjen07](https://forum.elixirforum.com/user_avatar/forum.elixirforum.com/cjen07/32/4410_2.png) [@cjen07](https://forum.elixirforum.com/u/cjen07)\
**Post date:** [July 19, 2017, 2:40am UTC](https://forum.elixirforum.com/t/fun-with-metaprogramming/6987/3 "2017-07-19T02:40:21Z")

</div>

my two recent project:  
1: [GitHub - cjen07/param\_pipe: parameterized pipe in elixir: |n\> · GitHub](https://github.com/cjen07/param_pipe)  
2: [GitHub - cjen07/prefix: the world is your playground, ∀ Q, ∃h, ∀ f, g ∈ Q, s.t h(f, g) "then" f ≡ g + f · GitHub](https://github.com/cjen07/prefix)
