# is used as both a unary and a binary operator.
As a unary operator: #x returns the length or cardinality of a list, set, hash table, or string x.
As a binary operator: x#i returns the ith element of a list, hash table, database, or string x.
i1 : L = {23, 42, 107, 2, 50}; |
i2 : #L o2 = 5 |
i3 : L#2 o3 = 107 |
The precedence of # when used as a binary operator is high, as high as ., but when used as a unary operator the precedence is much lower.