Learn: Operators

Every min program needs operators to:

There are two types of operators: symbols and sigils.

Symbols are the most common type of operator. A min symbol is a single word that is either provided by one of the predefined min modules like dup or . or defined by the user. User-defined symbols must:

It is possible to define symbols using the define symbol. The following min program defines a new symbol called square that duplicates the first element on the stack and multiplies the two elements:

 (dup *) "square" define

Besides symbols, min provides a set of predefined sigils for commonly-used symbols. For example, the previous definition could be rewritten as follows using sigils:

 (dup *) :square

A sigil like : can be prepended to a single-word string instead of using the corresponding symbol. Essentially, sigils are nothing more than syntactic sugar. Currently min provides the following sigils:

Alias for module.
Alias for delete.
Alias for quote.
Alias for define.
Alias for call.
Alias for bind.
Alias for save-symbol.
Alias for load-symbol.
Alias for quote-bind.
Alias for quote-define.
Alias for dget.
Alias for dset.
Alias for dhas?.
Alias for system.
Alias for run.
Alias for get-env.

→ Continue to Quotations