-
-
Notifications
You must be signed in to change notification settings - Fork 7
Open
Labels
x:action/improveImprove existing functionality/contentImprove existing functionality/contentx:knowledge/elementaryLittle Exercism knowledge requiredLittle Exercism knowledge requiredx:module/representerWork on RepresentersWork on Representersx:size/largeLarge amount of workLarge amount of workx:type/codingWrite code that is not student-facing content (e.g. test-runners, generators, but not exercises)Write code that is not student-facing content (e.g. test-runners, generators, but not exercises)
Description
This is mentioned in #29.
Struct names should be replaced by placeholders as well.
Example input
defmodule Something do
defstruct [:a, :b]
def something(%Something{a: a}), do: %Something{a: 2 * a}
def something_else(%__MODULE__{a: a}), do: %__MODULE__{a: 3 * a}
end
Desired output
defmodule(PLACEHOLDER_1) do
defstruct([:a, :b])
def(PLACEHOLDER_2(%PLACEHOLDER_1{a: PLACEHOLDER_3})) do
%PLACEHOLDER_1{a: 2 * PLACEHOLDER_3}
end
def(PLACEHOLDER_4(%__MODULE__{a: PLACEHOLDER_3})) do
%__MODULE__{a: 3 * PLACEHOLDER_3}
end
end
I think __MODULE__
should not be replaced, because it means different things in different modules. It's already normalized, in a way...
Current output
defmodule(PLACEHOLDER_1) do
defstruct([:a, :b])
def(PLACEHOLDER_2(%Something{a: PLACEHOLDER_3})) do
%Something{a: 2 * PLACEHOLDER_3}
end
def(PLACEHOLDER_4(%__MODULE__{a: PLACEHOLDER_3})) do
%__MODULE__{a: 3 * PLACEHOLDER_3}
end
end
angelikatyborska
Metadata
Metadata
Assignees
Labels
x:action/improveImprove existing functionality/contentImprove existing functionality/contentx:knowledge/elementaryLittle Exercism knowledge requiredLittle Exercism knowledge requiredx:module/representerWork on RepresentersWork on Representersx:size/largeLarge amount of workLarge amount of workx:type/codingWrite code that is not student-facing content (e.g. test-runners, generators, but not exercises)Write code that is not student-facing content (e.g. test-runners, generators, but not exercises)