next-ls icon indicating copy to clipboard operation
next-ls copied to clipboard

Convert a function capture lamda syntax to fn syntax

Open mhanberg opened this issue 2 months ago • 0 comments

A workspace command that converts a capture syntax lambda into an fn syntax version

Example:

defmodule Example do
  def run(list) do
    Enum.map(list, & &1 + 1)
  end
end

Using the workspace command on the capture operator will result in:

defmodule Example do
  def run(list) do
    Enum.map(list, fn one -> one + 1 end)
  end
end

Consider the following:

  • calculating the right number of parameters. a capture syntax might just say &3 in it, which means there are at least 3 parameters

mhanberg avatar Apr 30 '24 12:04 mhanberg