Why can’t I chain String.replace?

EDIT On the master branch of Elixir, the compiler will warn if a function is piped into without parentheses if there are arguments. This is an issue of precedence that can be fixed with explicit brackets: price |> to_string |> String.replace(“.”, “,”) |> String.replace(~r/,(\d)$/, “,\\1 0″) |> String.replace(” “, “”) Because function calls have a … Read more

How can I schedule code to run every few hours in Elixir or Phoenix framework?

There is a simple alternative that does not require any external dependencies: defmodule MyApp.Periodically do use GenServer def start_link(_opts) do GenServer.start_link(__MODULE__, %{}) end def init(state) do schedule_work() # Schedule work to be performed at some point {:ok, state} end def handle_info(:work, state) do # Do the work you desire here schedule_work() # Reschedule once more … Read more

Elixir Coin Change [closed]

try this defmodule MejorCambio do def darcambio(abono, adeudo) do td = abono – adeudo IO.inspect(“Tu cambio es de #{td}”) Enum.reduce([200,100,50,20,10, 5, 2, 1], %{abono: abono, adeudo: adeudo} , fn divisa, acc -> cambio = acc.abono – acc.adeudo repeat = div(cambio, divisa) acc2 = rem(cambio, divisa) %{deno: divisa , val: repeat} |> IO.inspect() %{acc | adeudo: … Read more

How can I remove elixir completly from Mac [closed]

You may want to install Elixir using Homebrew: brew install elixir In case you need to get aquatinted with Homebrew, visit the https://brew.sh. There, you’ll see the installation instruction, e.g.: /usr/bin/ruby -e “$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/master/install)”