# `Reactor.Dsl.Argument`
[🔗](https://github.com/ash-project/reactor/blob/main/lib/reactor/dsl/argument.ex/#L6)

The struct used to store `argument` DSL entities.

See `d:Reactor.step.argument`.

# `t`

```elixir
@type t() :: %Reactor.Dsl.Argument{
  __identifier__: any(),
  __spark_metadata__: Spark.Dsl.Entity.spark_meta(),
  description: nil | String.t(),
  name: atom(),
  source: Reactor.Template.t(),
  transform: nil | (any() -&gt; any()) | {module(), keyword()} | mfa()
}
```

# `element`

```elixir
@spec element(any(), [any()]) :: Reactor.Template.Element.t()
```

The `element` template helper for the Reactor DSL.

## Example

```elixir
defmodule ExampleReactor do
  use Reactor

  input :numbers

  map :double_numbers do
    source input(:numbers)

    step :double do
      argument :number, element(:double_numbers)

      run fn args, _ ->
        {:ok, args.number * 2}
      end
    end

    return :double
  end
end
```

# `input`

```elixir
@spec input(atom(), [any()]) :: Reactor.Template.Input.t()
```

The `input` template helper for the Reactor DSL.

## Example

```elixir
defmodule ExampleReactor do
  use Reactor

  input :name

  step :greet do
    # here: --------↓↓↓↓↓
    argument :name, input(:name)
    run fn
      %{name: nil}, _, _ -> {:ok, "Hello, World!"}
      %{name: name}, _, _ -> {:ok, "Hello, #{name}!"}
    end
  end
end
```

## Extracting nested values

You can provide a list of keys to extract from a data structure, similar to
`Kernel.get_in/2` with the condition that the input value is either a struct
or implements the `Access` protocol.

# `result`

```elixir
@spec result(atom(), [any()]) :: Reactor.Template.Result.t()
```

The `result` template helper for the Reactor DSL.

## Example

```elixir
defmodule ExampleReactor do
  use Reactor

  step :whom do
    run fn _, _ ->
      {:ok, Enum.random(["Marty", "Doc", "Jennifer", "Lorraine", "George", nil])}
    end
  end

  step :greet do
    # here: --------↓↓↓↓↓↓
    argument :name, result(:whom)
    run fn
      %{name: nil}, _, _ -> {:ok, "Hello, World!"}
      %{name: name}, _, _ -> {:ok, "Hello, #{name}!"}
    end
  end
end
```

## Extracting nested values

You can provide a list of keys to extract from a data structure, similar to
`Kernel.get_in/2` with the condition that the result is either a struct or
implements the `Access` protocol.

# `value`

```elixir
@spec value(any()) :: Reactor.Template.Value.t()
```

The `value` template helper for the Reactor DSL.

## Example

```elixir
defmodule ExampleReactor do
  use Reactor

  input :number

  step :times_three do
    argument :lhs, input(:number)
    # here: -------↓↓↓↓↓
    argument :rhs, value(3)

    run fn args, _ ->
      {:ok, args.lhs * args.rhs}
    end
  end
end
```

---

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