shrub/pub/doc/interpreter/glossary.md

346 lines
11 KiB
Markdown
Raw Normal View History

2015-02-18 06:03:21 +03:00
<div class="short">
Glossary
========
### arm
2015-02-18 06:03:21 +03:00
A key-value pair of a name ([++term]()) to an expression ([++foot()]).
Used primarily in [core]() construction. Arms can contain either
functions or data. You can think of them like named properties inside an
object.
------------------------------------------------------------------------
### atom
2015-02-18 06:03:21 +03:00
An atom is a natural number. More here..?
------------------------------------------------------------------------
### axil
2015-02-18 06:03:21 +03:00
An `[%axil p=base]` is a simple [`++tile`]() for a few basic icons: an
atom of any odor, a noun (`*`) , a cell of nouns (`^`), a loobean (`?`),
and null (`~`).
------------------------------------------------------------------------
### battery
2015-02-18 06:03:21 +03:00
[Cores], at the most basic level, are of the structure [battery
payload]. The battery consists of the code contained within a core.
------------------------------------------------------------------------
### `%bark`
2015-02-18 06:03:21 +03:00
A `[%bark p=term q=tile]` is a [`++tile`]() with a name wrapped around
it. Its [icon]() is a [`++face`](). The rune associated with a
[`%bark`]() is [`$=`]().
------------------------------------------------------------------------
### bunt
2015-02-18 06:03:21 +03:00
The bunt of a [`++tile`]() produces a [`++twig`]() that creates a blank
default example its [icon](). Bunting is like explicitly asking for the
default value of a type. Unlike in other languages, this always exists
in Hoon. See also [`$*`]().
------------------------------------------------------------------------
### `%bush`
2015-02-18 06:03:21 +03:00
a [`[%bush p=tile q=tile]`]() is a [`++tile`]() in which there are two
kinds of [nouns](): cells whose head is a cell (`++tile` p) and cells
whose head is an atom (`++tile` q). Its default value is the value of
`q`, and its icon is a [`++fork`]()
------------------------------------------------------------------------
### cell
2015-02-18 06:03:21 +03:00
A cell is an ordered pair of nouns.
------------------------------------------------------------------------
### clam
2015-02-18 06:03:21 +03:00
The clam of a [`++tile`]() is a [gate]() that accepts an arbitrary
[noun]() and always produces a member of the [icon]() of the `++tile`.
If the gate is passed a [sample]() that is a member of the icon, it will
produce that sample. If the gate is passed a noun outside of the domain
of the icon, it will produced the [bunt]() of the icon. You can think of
a clam as a validator function for an icon. To clam a `++tile` is to
produce its clam. See also: [`$,`](). SEE ALSO!!
------------------------------------------------------------------------
### context
2015-02-18 06:03:21 +03:00
In [gate]() construction, an arm is pulled from a [core]() and pushed
onto the subject creating a structure of [formula [sample context]],
where the context is the previous subject, commonly a core. In Hoon, the
whole kernel is typically included in your subject, so you can think of
context in hoon in a similar way to context in the traditional
functional programming sense.
------------------------------------------------------------------------
### cons
2015-02-18 06:03:21 +03:00
Cell constructor, similar to [cons in other functional
languages](http://en.wikipedia.org/wiki/Cons). Constructs a cell
containing two [`++twigs`]() into a twig that produces a cell of the
results of the two original sub-twigs.
------------------------------------------------------------------------
### core
2015-02-18 06:03:21 +03:00
At the Nock level, a core is any [subject]() that contains both code and
data, named battery and payload respectively. At the Hoon level, a core
is very similar to an object with named properties that can be either
functions or data. For more information, see the [`|` rune section]() of
the Hoon library.
------------------------------------------------------------------------
### `%cube`
2015-02-18 06:03:21 +03:00
------------------------------------------------------------------------
### door
2015-02-18 06:03:21 +03:00
A door is a [core]() with a sample. Door are used.../you can think of
doors...
------------------------------------------------------------------------
### dry
2015-02-18 06:03:21 +03:00
In a dry computation, typechecking occurs at compile-time to ensure that
all inputs match its [sample]() [++tile](). The formal term for dry is
`%ash`.
------------------------------------------------------------------------
### engine
2015-02-18 06:03:21 +03:00
Engines are [core]()s that contain several [arm]()s that each perform
one of a related set of operations on the core's sample. For example,
there is a container engine for all of the set operations. You can think
of engines as objects with methods that modify its data.
------------------------------------------------------------------------
### `%face`
2015-02-18 06:03:21 +03:00
------------------------------------------------------------------------
### fern
2015-02-18 06:03:21 +03:00
A `[%fern p=[i=tile t=(list tile)]]` is a [`++tile`]() for a non-empty
list of cases. Its icon is naturally a [`%fork`](). The programmer is
responsible for ensuring that the cases are actually orthogonal (unlike
with the structured `%fork`s, [`%bush`](), [`%kelp`]() and [`%reed`]).
------------------------------------------------------------------------
### fishing
2015-02-18 06:03:21 +03:00
To fish is to test if a [noun]() matches a specific `++tile`, using the
natural rune [`?=`](). Some languages call fishing "pattern matching".
------------------------------------------------------------------------
### frond
2015-02-18 06:03:21 +03:00
A frond is a case of a [kelp](), which is a [discriminated (or tagged)
union](http://en.wikipedia.org/wiki/Tagged_union).
------------------------------------------------------------------------
### gate
2015-02-18 06:03:21 +03:00
A [gate]() is a [core]() with one arm [`$`]() with a [payload]() that is
a cell of the form [[sample]() [context]()]. Gates are the closest thing
Hoon has to functions in the traditional sense.
------------------------------------------------------------------------
### `%gold`
2015-02-18 06:03:21 +03:00
------------------------------------------------------------------------
### herb
2015-02-18 06:03:21 +03:00
An `[%herb p=twig]`....
------------------------------------------------------------------------
### icon
2015-02-18 06:03:21 +03:00
The icon of a [`++tile`]() is the type associated with that `++tile`. A
`++tile` is a convenient way of specifying a type, which is its icon.
`++tile`s are used in a similar way to [type signatures]() for their
icons.
------------------------------------------------------------------------
### `%iron`
2015-02-18 06:03:21 +03:00
`%iron` is a variance type for [cores]() where their [sample]()s cannot
be read. You can think of can be thought of as similar to a private
function.
Not quite sure about this one.
------------------------------------------------------------------------
### `%kelp`
2015-02-18 06:03:21 +03:00
a [`%kelp p=[i=line t=(list line)]`] is a [discriminated, or tagged,
union](http://en.wikipedia.org/wiki/Tagged_union). In Hoon, the head,
which is called the stem, must be a [`%leaf`](). The tail, which can be
anything, is the bulb. Cases of a kelp are known as [fronds]().
------------------------------------------------------------------------
### kick
2015-02-18 06:03:21 +03:00
To pull the empty name `$` on a core is to kick it. You can think of
kicking like calling a function with its default arguments.
------------------------------------------------------------------------
### noun
2015-02-18 06:03:21 +03:00
A noun is an [atom]() or a [cell](). Everything in Hoon is a noun.
------------------------------------------------------------------------
### `%$` buc
2015-02-18 06:03:21 +03:00
`%$`, or `$` for short, is the empty name in Hoon.
------------------------------------------------------------------------
### leg
2015-02-18 06:03:21 +03:00
If the result of [pulling]() something from `x` is a subtree, then it is
a leg.
More here? Existing doc isn't quite clear here..
------------------------------------------------------------------------
### `%lead`
2015-02-18 06:03:21 +03:00
------------------------------------------------------------------------
### `%leaf`
2015-02-18 06:03:21 +03:00
A `%leaf` is a [`++tile`]() consisting of an atomic constant of value
`q` and odor `p`. Its icon is a [`%cube`](). The syntax for a leaf is
the same as the syntax for a [`++twig`](), except that % is never
required to generate a cube. For instance, as a twig, 7 has a type of
[%atom %ud]; %7 has a type of [%cube 7 [%atom %ud]]. But the icon of the
leaf 7 is, again, [%cube 7 [%atom %ud]].
Copied the bottom half from existing doc. Not sure about this one...
------------------------------------------------------------------------
### loobean
2015-02-18 06:03:21 +03:00
------------------------------------------------------------------------
### payload
2015-02-18 06:03:21 +03:00
[Cores](), at the most basic level, are of the structure [battery
payload]. The payload consists of the data contained within a core. You
can think of the payload as similar to the data of an object.
------------------------------------------------------------------------
### pull
2015-02-18 06:03:21 +03:00
To access a [wing]() or [limb]() in a [core]() is to pull it. For
instance, when we write `a.b.x` (a within b from x), we are pulling the
wing `a.b` from `x`.
------------------------------------------------------------------------
### `%reed`
2015-02-18 06:03:21 +03:00
A `[%reed p=tile q=tile]` is a [`++tile`]() whose [icon]() contains two
kinds of nouns: atoms of `++tile` `p` and cells of `++tile` `q`. The
rune associated with reeds is [`$|`]().
------------------------------------------------------------------------
### sample
2015-02-18 06:03:21 +03:00
In [gate]() construction, an arm is pulled from a [core]() and pushed
onto the subject creating a structure of [formula [sample context]],
where the sample represents the gate's inputs. All gates are constructed
with a default sample value. Thus, when we call a gate with arguments,
we are actually replacing its sample.
------------------------------------------------------------------------
### slam
2015-02-18 06:03:21 +03:00
To pull the empty name `$` on a [gate]() `g` with its [sample]()
replaced by a given input `a` is to slam `g` with `a`. You can think of
slamming like passing input parameters to a function that's being
called.
------------------------------------------------------------------------
### subject
2015-02-18 06:03:21 +03:00
All Hoon expressions a parsed into abstract syntax trees, which in Hoon
are called [++twig]()s. Twigs are [nouns]() that are converted into Nock
expressions, which are all of the basic form [subject formula], where
the subject is the data and the formula is the program. Thus, in both
Hoon and Nock, subject can refer to any piece of data that is being
operated on by a formula.
------------------------------------------------------------------------
### `++tile`
2015-02-18 06:03:21 +03:00
A `++tile` is a convenient way of specifying a type, which is its icon.
`++tile`s are used in a similar way to [type signatures]() for their
icons.
SOMETHING ABOUT THE DIFFERENCE BETWEEN TWIG AND TILE AUTOCONS.
------------------------------------------------------------------------
### weed
2015-02-18 06:03:21 +03:00
A `[%weed p=twig]`
------------------------------------------------------------------------
### wet
2015-02-18 06:03:21 +03:00
In wet computations, the product type is checked to be the same as the
input type, rather than the [sample]() [tile](). The formal term for wet
is `%elm`.
------------------------------------------------------------------------
### wing
2015-02-18 06:03:21 +03:00
A wing is a list of limbs. For example, when we [pull] `a.b` from `x`,
`a.b` is a wing. `a` and `b` individually are both [limbs]().
------------------------------------------------------------------------
</div>