# Names and help


<!-- WARNING: THIS FILE WAS AUTOGENERATED! DO NOT EDIT! -->

## Names

``` bpl
]help •nc
```

# `•nc` — Name class

`•nc names` gives the class of each name: `¯1` invalid, `0` undefined,
`2` value, `3` function, `4` operator. A character vector names one
binding. [Introspection](introspection.ipynb) has examples.

``` bpl
v←1 2 3 ⋄ mean←{+/⍵ ÷ ≢⍵}
•nc "v"
•nc "mean" "absent"
```

    2ₓ

    [3 0]ₓ

``` bpl
]help •nl
```

# `•nl` — Name list

`prefix •nl classes` lists the visible user names in `classes` that
begin with `prefix`, as a sorted vector of strings. `•nl classes` lists
them all. [Introspection](introspection.ipynb) has examples.

Errors: `DOMAIN` for unsupported classes; `RANK` for a class matrix.

Shadowed names appear once. Implicit argument and operand names are left
out:

``` bpl
mean←{+/⍵ ÷ ≢⍵}
"me" •nl 3
"absent" •nl 2 3 4
```

    ["mean"]

    0⍴⊂""

``` bpl
]help •src
```

# `•src` — Source

`•src name` returns the definition text of a function or operator,
including comments. [Introspection](introspection.ipynb) has examples.

Errors: `VALUE` for an undefined name; `DOMAIN` for an argument that
isn’t a name.

Primitives and derived functions give their BPL representation:

``` bpl
f←{≥⍵} ⋄ add←+
•src "f"
•src "add"
```

    {≥⍵}

    +

``` bpl
]help •ex
```

# `•ex` — Erase

`•ex names` erases the nearest binding of each name. An outer binding
can then become visible. It returns `1` when the name is gone, and `0`
for an invalid or protected name. [Introspection](introspection.ipynb)
has examples.

An already absent name also gives `1`. Retained function handles stay
usable:

``` bpl
v←1
•ex "v"
•ex "v"
•ex "$a"
```

    1ₓ

    1ₓ

    0ₓ

## Interactive help

`]help name` shows help in the REPL and in notebooks. A leading `⍝`
comment block inside a definition supplies its help text:

``` bpl
mean←{⍝ Mean of a vector
    +/⍵ ÷ ≢⍵}
```

`]help mean` shows the comment:

``` bpl
]help mean
```

Calls: `f Y` or `X f Y`

Mean of a vector

`-source` shows the definition:

``` bpl
]help mean -source
```

``` apl
{⍝ Mean of a vector
    +/⍵ ÷ ≢⍵}
```

Glyphs work too. Their help comes from the glyph pages:

``` bpl
]help ?
```

# `?` — Predicate

In a dfn, `C?` ends a predicate. When `C` is true, the rest of the body
runs. When it’s false, the dfn moves on to its next body, after `;`.

``` bpl
{⍵<0?-⍵;⍵}¯3      ⍝ 3
{⍵<0?-⍵;⍵}4       ⍝ 4
```

Statements before a predicate run first. After it, a body can run
several statements, or hold more predicates.

``` bpl
{⍵<0?a←-⍵ ⋄ a×2;⍵}¯3   ⍝ 6
{⍵>0?⍵<10?⍵;0}15       ⍝ 0
```

`C` must be a Boolean singleton. A body that ends after its predicate
returns no result. If every predicate fails, the call is a `DOMAIN`
error. See [Dfns](dfns.ipynb).

In the BPL kernel, Shift-Tab inspects the name or glyph at the cursor.
Tab completes user names, system names and backtick glyph names.

Inspection reads definitions without executing them. Arbitrary dfns show
the one-/two-argument calling convention without inferring their
supported valence.

[Python](python.ipynb) covers help and completion for Python `Function`
objects in IPython.
