code --list-extensions
LeCrunchic.mariana-nord
PeterJausovec.vscode-docker
Shan.code-settings-sync
Valentin.beamdasm
WallabyJs.quokka-vscode
defmodule ElixirBuzz do | |
@moduledoc "It implements a fizzbuzz solution with cond" | |
@doc """ | |
Returns a range from 1 to the given number in as list substituting a number for a pre-defined string when divisible by 3, 5, or 15 (3 and 5) | |
""" | |
def buzz(number) do | |
Enum.map(1..number, fn n -> | |
cond do | |
rem(n, 15) == 0 -> "ElixirBuzz" |
==> comeonin | |
make: Nothing to be done for `priv/bcrypt_nif.so'. | |
Compiled lib/comeonin.ex | |
== Compilation error on file lib/comeonin/bcrypt.ex == | |
23:08:33.076 [error] Error in process <0.271.0> with exit value: {{badmatch,{error,{bad_lib,"Library version (2.7) not compatible (with 2.6)."}}},[{'Elixir.Comeonin.Bcrypt',init,0,[{file,"lib/comeonin/bcrypt.ex"},{line,22}]},{code_server,'-handle_on_load/4-fun-0-',1,[{file,"code_serv... | |
** (MatchError) no match of right hand side value: {:error, :on_load_failure} | |
(stdlib) erl_eval.erl:657: :erl_eval.do_apply/6 |
defmodule Account do | |
defstruct id: nil, balance: 0 | |
def withdraw(account_id, amount) do | |
account_id | |
|> find | |
|> make_withdrawal(amount) | |
end | |
defp find(account_id) do |
# setup | |
user = %{name: “Foo”} | |
new_name = %{name: “bar”} | |
# without pipe | |
updated_user = Map.put(user, :name, new_name) | |
validate_user = validate(updated_user) | |
# etc… | |
# with pipe |
# setup | |
user = %{name: “Foo”} | |
new_name = %{name: “bar”} | |
# single transformation without pipe | |
Map.put(user, :name, new_name) | |
# single transformation with pipe | |
user |> Map.put(:name, new_name) |
defmodule Roman do | |
@arabic_roman %{ | |
1 => "I", | |
5 => "V", | |
10 => "X", | |
50 => "L", | |
100 => "C", | |
500 => "D", | |
1000 => "M" | |
} |
imestamp = fn -> | |
{_date, {hour, minute, _second}} = :calendar.local_time() | |
[hour, minute] | |
|> Enum.map( | |
&String.pad_leading(Integer.to_string(&1), 2, "0") | |
) | |
|> Enum.join(":") | |
end |
I hereby claim:
To claim this, I am signing this object: