Jido.Skills.Arithmetic (Jido v1.1.0-rc)
View SourceProvides basic arithmetic operations as a Skill.
This skill exposes arithmetic operations like addition, subtraction, multiplication, division and squaring through a signal-based interface.
Summary
Functions
Handle an arithmetic signal.
Get the initial state for the arithmetic skill.
Process the result of an arithmetic operation.
Skill: Arithmetic Signal Contracts
Functions
@spec handle_signal(Jido.Signal.t()) :: {:ok, Jido.Signal.t()}
Handle an arithmetic signal.
@spec initial_state() :: map()
Get the initial state for the arithmetic skill.
@spec process_result(Jido.Signal.t(), {:ok, map()} | {:error, String.t()}) :: {:ok, Jido.Signal.t()}
Process the result of an arithmetic operation.
@spec routes() :: [map()]
Skill: Arithmetic Signal Contracts:
- Incoming:
- arithmetic.add: Add two numbers
- arithmetic.subtract: Subtract two numbers
- arithmetic.multiply: Multiply two numbers
- arithmetic.divide: Divide two numbers
- arithmetic.square: Square a number
- arithmetic.eval: Evaluate a mathematical expression
- Outgoing:
- arithmetic.result: Result of arithmetic operation
- arithmetic.error: Error from arithmetic operation