# Purity validation

**URL:** <https://forum.elixirforum.com/t/purity-validation/30243>\
**Category:** Questions\
**Tags:** pure-functions\
**Created:** [March 31, 2020, 10:24am UTC](https://forum.elixirforum.com/t/purity-validation/30243 "2020-03-31T10:24:30Z")\
**Posts on this page:** 1\
**Showing post:** 2

<div class="post-metadata">

**Author:** ![lpil](https://forum.elixirforum.com/user_avatar/forum.elixirforum.com/lpil/32/17492_2.png) [@lpil](https://forum.elixirforum.com/u/lpil)\
**Post date:** [March 31, 2020, 10:30am UTC](https://forum.elixirforum.com/t/purity-validation/30243/2 "2020-03-31T10:30:45Z")

</div>

If you want to know if a macro is a valid guard you can use [Macro — Elixir v1.20.2](https://hexdocs.pm/elixir/Macro.html#expand/2) and then traverse the AST, checking if all the calls in that AST are guards themselves.

If you wish to know whether a function it pure it is a much more difficult task, one not possible with the Elixir compiler today.

> [@tim2CF](#):
>
> because it’s doing this purity validation well.

What do you mean by this? The Elixir compiler does not know whether functions are pure or not.

---

_[View the full topic](https://forum.elixirforum.com/t/purity-validation/30243)._
