object

# `halstead_metric(Stroud)`

- `Stroud` - Coeficient for computing the time required to program.

Computes Halstead complexity numbers for an entity.

Author: Paulo Moura
Version: 0.7
Date: 2018/7/18
Compilation flags:
`static, context_switching_calls`
Imports:
`public` code_metrics_utilities
`public` code_metric
Uses:
list
numberlist
pairs
Remarks:

> - Definition of operators: Predicates declared, user-defined, and called are interpreted as operators. Built-in predicates and built-in control constructs are ignored.

> - Definition of operands: Predicate arguments are abstracted and interpreted as operands. Note that this definition of operands is a significant deviation from the original definition, which used syntactic literals.

> - Pn: Number of distinct predicates (declared, defined, called, or updated)

> - PAn: Number of predicate arguments (assumed distinct)

> - Cn: Number of predicate calls/updates + number of clauses

> - CAn: Number of predicate call/update arguments + number of clause head arguments

> - EV: Entity vocabulary: `EV = Pn + PAn`

> - EL: Entity length: `EL = Cn + CAn`

> - V: Volume: `V = EL * log2(EV)`

> - D: Difficulty: `D = (Pn/2) * (CAn/An)`

> - E: Effort: `E = D * V`

> - T: Time required to program: `T = E/k` seconds (`k` is the Stroud number; defaults to 18)

> - B: Number of delivered bugs: `B = V/3000`

> - Entity score: Represented as the compound term `pn_pan_cn_can_ev_el_v_d_e_t_b/11`.

- Public predicates

- Protected predicates

- Private predicates

- Operators

## Public predicates

(see entity ancestors)

## Protected predicates

(see entity ancestors)

## Private predicates

(see entity ancestors)

## Operators

(none)