# `PtcRunner.Lisp.Eval.Effects`
[🔗](https://github.com/andreasronge/ptc_runner/blob/main/lib/ptc_runner/lisp/eval/effects.ex#L1)

Canonical evaluator audit effects and their ordering algebra.

Effect lists are stored newest-first while evaluation is in progress. Merging
therefore places the newer delta before the older value. Prelude call counts
add, and newer cache writes win key conflicts.

# `t`

```elixir
@type t() :: %PtcRunner.Lisp.Eval.Effects{
  pmap_calls: [map()],
  prelude_call_counts: %{required(String.t()) =&gt; non_neg_integer()},
  prints: [String.t()],
  tool_cache: map(),
  tool_calls: [map()]
}
```

# `add_prelude_counts`

```elixir
@spec add_prelude_counts(t(), %{required(String.t()) =&gt; non_neg_integer()}) :: t()
```

Adds prelude-call counts without changing other effect fields.

# `chronological`

```elixir
@spec chronological(t()) :: t()
```

Returns effects in their public chronological representation.

# `delta`

```elixir
@spec delta(t(), t()) :: t()
```

Computes the effects added to a cumulative value after a baseline.

List suffixes and count baselines are removed. Cache entries are retained
when their value differs from the baseline, including overwrites of an
existing key.

# `empty`

```elixir
@spec empty() :: t()
```

Returns an empty effect value.

# `merge`

```elixir
@spec merge(t(), t()) :: t()
```

Merges a newer effect value onto an older one.

Lists remain newest-first, counts add, and newer cache entries win.

# `merge_ordered`

```elixir
@spec merge_ordered([t()]) :: t()
```

Merges effect deltas already ordered by ascending semantic execution order.

# `record_cache`

```elixir
@spec record_cache(t(), term(), term()) :: t()
```

Records one cache write.

# `record_pmap_call`

```elixir
@spec record_pmap_call(t(), map()) :: t()
```

Records one parallel-call ledger entry in newest-first order.

# `record_prelude_call`

```elixir
@spec record_prelude_call(t(), String.t()) :: t()
```

Increments one public prelude-call count.

# `record_print`

```elixir
@spec record_print(t(), String.t()) :: t()
```

Records one already-bounded print in newest-first order.

# `record_tool_call`

```elixir
@spec record_tool_call(t(), map()) :: t()
```

Records one already-compacted tool ledger entry in newest-first order.

---

*Consult [api-reference.md](api-reference.md) for complete listing*
