Jido.Skills.Arithmetic (Jido v1.2.0)

View Source

Provides 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.

Skill: Arithmetic Signal Contracts

Process the result of an arithmetic operation.

Functions

handle_signal(signal)

@spec handle_signal(Jido.Signal.t()) :: {:ok, Jido.Signal.t()}

Handle an arithmetic signal.

router(opts)

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

transform_result(signal, arg)

@spec transform_result(Jido.Signal.t(), {:ok, map()} | {:error, String.t()}) ::
  {:ok, Jido.Signal.t()}

Process the result of an arithmetic operation.