# A *complete* listing of operators in Nix, and their predence.

<p class="callout info">This article was originally published at [https://gist.github.com/joepie91/c3c047f3406aea9ec65eebce2ffd449d](https://gist.github.com/joepie91/c3c047f3406aea9ec65eebce2ffd449d).</p>

<p class="callout warning">The information in this article has since been absorbed into the official Nix manual. It is kept here for posterity. It may be outdated by the time you read this.</p>

Lower precedence means a stronger binding; ie. this list is sorted from strongest to weakest binding, and in the case of equal precedence between two operators, the associativity decides the binding.

<table id="bkmrk-prec-abbreviation-ex" style="width: 100%;"><thead><tr><th style="width: 5.95948%;">Prec</th><th style="width: 12.1573%;">Abbreviation</th><th style="width: 21.0956%;">Example</th><th style="width: 6.55642%;">Assoc</th><th style="width: 54.2312%;">Description</th></tr></thead><tbody><tr><td style="width: 5.95948%;">1</td><td style="width: 12.1573%;">SELECT</td><td style="width: 21.0956%;">`e . attrpath [or def]`</td><td style="width: 6.55642%;">none</td><td style="width: 54.2312%;">Select attribute denoted by the attribute path `attrpath` from set `e`. (An attribute path is a dot-separated list of attribute names.) If the attribute doesn’t exist, return `default` if provided, otherwise abort evaluation.</td></tr><tr><td style="width: 5.95948%;">2</td><td style="width: 12.1573%;">APP</td><td style="width: 21.0956%;">`e1 e2`</td><td style="width: 6.55642%;">left</td><td style="width: 54.2312%;">Call function `e1` with argument `e2`.</td></tr><tr><td style="width: 5.95948%;">3</td><td style="width: 12.1573%;">NEG</td><td style="width: 21.0956%;">`-e`</td><td style="width: 6.55642%;">none</td><td style="width: 54.2312%;">Numeric negation.</td></tr><tr><td style="width: 5.95948%;">4</td><td style="width: 12.1573%;">HAS\_ATTR</td><td style="width: 21.0956%;">`e ? attrpath`</td><td style="width: 6.55642%;">none</td><td style="width: 54.2312%;">Test whether set `e` contains the attribute denoted by `attrpath`; return true or false.</td></tr><tr><td style="width: 5.95948%;">5</td><td style="width: 12.1573%;">CONCAT</td><td style="width: 21.0956%;">`e1 ++ e2`</td><td style="width: 6.55642%;">right</td><td style="width: 54.2312%;">List concatenation.</td></tr><tr><td style="width: 5.95948%;">6</td><td style="width: 12.1573%;">MUL</td><td style="width: 21.0956%;">`e1 * e2`</td><td style="width: 6.55642%;">left</td><td style="width: 54.2312%;">Numeric multiplication.</td></tr><tr><td style="width: 5.95948%;">6</td><td style="width: 12.1573%;">DIV</td><td style="width: 21.0956%;">`e1 / e2`</td><td style="width: 6.55642%;">left</td><td style="width: 54.2312%;">Numeric division.</td></tr><tr><td style="width: 5.95948%;">7</td><td style="width: 12.1573%;">ADD</td><td style="width: 21.0956%;">`e1 + e2`</td><td style="width: 6.55642%;">left</td><td style="width: 54.2312%;">Numeric addition, or string concatenation.</td></tr><tr><td style="width: 5.95948%;">7</td><td style="width: 12.1573%;">SUB</td><td style="width: 21.0956%;">`e1 - e2`</td><td style="width: 6.55642%;">left</td><td style="width: 54.2312%;">Numeric subtraction.</td></tr><tr><td style="width: 5.95948%;">8</td><td style="width: 12.1573%;">NOT</td><td style="width: 21.0956%;">`!e`</td><td style="width: 6.55642%;">left</td><td style="width: 54.2312%;">Boolean negation.</td></tr><tr><td style="width: 5.95948%;">9</td><td style="width: 12.1573%;">UPDATE</td><td style="width: 21.0956%;">`e1 // e2`</td><td style="width: 6.55642%;">right</td><td style="width: 54.2312%;">Return a set consisting of the attributes in `e1` and `e2` (with the latter taking precedence over the former in case of equally named attributes).</td></tr><tr><td style="width: 5.95948%;">10</td><td style="width: 12.1573%;">LT</td><td style="width: 21.0956%;">`e1 < e2`</td><td style="width: 6.55642%;">left</td><td style="width: 54.2312%;">Less than.</td></tr><tr><td style="width: 5.95948%;">10</td><td style="width: 12.1573%;">LTE</td><td style="width: 21.0956%;">`e1 <= e2`</td><td style="width: 6.55642%;">left</td><td style="width: 54.2312%;">Less than or equal.</td></tr><tr><td style="width: 5.95948%;">10</td><td style="width: 12.1573%;">GT</td><td style="width: 21.0956%;">`e1 > e2`</td><td style="width: 6.55642%;">left</td><td style="width: 54.2312%;">Greater than.</td></tr><tr><td style="width: 5.95948%;">10</td><td style="width: 12.1573%;">GTE</td><td style="width: 21.0956%;">`e1 >= e2`</td><td style="width: 6.55642%;">left</td><td style="width: 54.2312%;">Greater than or equal.</td></tr><tr><td style="width: 5.95948%;">11</td><td style="width: 12.1573%;">EQ</td><td style="width: 21.0956%;">`e1 == e2`</td><td style="width: 6.55642%;">none</td><td style="width: 54.2312%;">Equality.</td></tr><tr><td style="width: 5.95948%;">11</td><td style="width: 12.1573%;">NEQ</td><td style="width: 21.0956%;">`e1 != e2`</td><td style="width: 6.55642%;">none</td><td style="width: 54.2312%;">Inequality.</td></tr><tr><td style="width: 5.95948%;">12</td><td style="width: 12.1573%;">AND</td><td style="width: 21.0956%;">`e1 && e2`</td><td style="width: 6.55642%;">left</td><td style="width: 54.2312%;">Logical AND.</td></tr><tr><td style="width: 5.95948%;">13</td><td style="width: 12.1573%;">OR</td><td style="width: 21.0956%;">`e1 || e2`</td><td style="width: 6.55642%;">left</td><td style="width: 54.2312%;">Logical OR.</td></tr><tr><td style="width: 5.95948%;">14</td><td style="width: 12.1573%;">IMPL</td><td style="width: 21.0956%;">`e1 -> e2`</td><td style="width: 6.55642%;">none</td><td style="width: 54.2312%;">Logical implication (equivalent to `!e1 || e2`).</td></tr></tbody></table>