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

This article was originally published at [https://gist.github.com/joepie91/c3c047f3406aea9ec65eebce2ffd449d](https://gist.github.com/joepie91/c3c047f3406aea9ec65eebce2ffd449d).

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.

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.
PrecAbbreviationExampleAssocDescription
1SELECT`e . attrpath [or def]`noneSelect 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.
2APP`e1 e2`leftCall function `e1` with argument `e2`.
3NEG`-e`noneNumeric negation.
4HAS\_ATTR`e ? attrpath`noneTest whether set `e` contains the attribute denoted by `attrpath`; return true or false.
5CONCAT`e1 ++ e2`rightList concatenation.
6MUL`e1 * e2`leftNumeric multiplication.
6DIV`e1 / e2`leftNumeric division.
7ADD`e1 + e2`leftNumeric addition, or string concatenation.
7SUB`e1 - e2`leftNumeric subtraction.
8NOT`!e`leftBoolean negation.
9UPDATE`e1 // e2`rightReturn a set consisting of the attributes in `e1` and `e2` (with the latter taking precedence over the former in case of equally named attributes).
10LT`e1 < e2`leftLess than.
10LTE`e1 <= e2`leftLess than or equal.
10GT`e1 > e2`leftGreater than.
10GTE`e1 >= e2`leftGreater than or equal.
11EQ`e1 == e2`noneEquality.
11NEQ`e1 != e2`noneInequality.
12AND`e1 && e2`leftLogical AND.
13OR`e1 || e2`leftLogical OR.
14IMPL`e1 -> e2`noneLogical implication (equivalent to `!e1 || e2`).