Identity, Null¶
When the generic null is applied to another value, it is the Identity function.
Indexing with the generic null has the same effect.
:: Identity¶
Return a value unchanged
Applying null to a value¶
(::) x ::[x]
Where x is any value, returns x.
Applying multiple functions to the same data, with one of the operations as “do nothing”.
Applying a value to null¶
x :: x[::]
Identity can also be achieved via indexing.
and used in variants thereof for e.g. amends
When prefix notation is used, x does not have to be an applicable value.
:: Null¶
Q does not have a dedicated null type. Instead :: is used to denote a generic null value. For example, functions that ‘return no value’, actually return ::.
We use enlist above to force display of a null result – a pure :: is not displayed.
When a unary function is called with no arguments, :: is passed in.
Use :: to prevent a mixed list changing type.
Since :: has a type for which no vector variant exists, it is useful to prevent a mixed list from being coerced into a vector when all items happen to be of the same type. (This is important when you need to preserve the ability to add non-conforming items later.)
but