Gate

A Hoon “function” that (1) takes input, (2) performs work [a computation], and (3) produces some output. A gate has 2 elements – a Battery and a Payload:
Battery of a gate contains exactly one arm, which has the special name $. The $ arm contains the instructions for the function in question.
Payload of a gate consists of a cell of [sample context]. The sample stores the ‘argument’ (i.e., input value). The context contains all other data that is needed.