# Marking more standard library methods as pure to enable LLVM optimizations?

**URL:** <https://discourse.julialang.org/t/marking-more-standard-library-methods-as-pure-to-enable-llvm-optimizations/28732>\
**Category:** Internals & Design\
**Created:** [September 13, 2019, 6:40pm UTC](https://discourse.julialang.org/t/marking-more-standard-library-methods-as-pure-to-enable-llvm-optimizations/28732 "2019-09-13T18:40:06Z")\
**Posts on this page:** 1\
**Showing post:** 8

<div class="post-metadata">

**Author:** ![chakravala](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/chakravala/32/6832_2.png) [@chakravala](https://discourse.julialang.org/u/chakravala)\
**Post date:** [September 14, 2019, 2:52pm UTC](https://discourse.julialang.org/t/marking-more-standard-library-methods-as-pure-to-enable-llvm-optimizations/28732/8 "2019-09-14T14:52:26Z")

</div>

> [@Olof\_Salberger](#):
>
> Is it possible to declare a particular set of methods of a function pure without duplicating generic code?

To elaborate, what I’ve done in Grassmann.jl is to define some of my own dispatch such as

```Julia
module Grassmann
@pure binomial(n::Int,k::Int) = Base.binomial(n,k)
end

```

This replaces the `Base.binomial` method with a local method that is pure.

It is not recommended to make the base arithmetic pure, but you can easily make pure versions of base methods locally by simply redirecting dispatch. This does not affect the global behavior, only local.

---

_[View the full topic](https://discourse.julialang.org/t/marking-more-standard-library-methods-as-pure-to-enable-llvm-optimizations/28732)._
