ProMode (pro_mode v0.1.23)
Brevity is bliss.
- APLJKQ
Provides shortcuts for common Elixir functions.
Link to this section Summary
Functions
Enum.at
Enum.all?
Enum.any?
Enum.concat
System.cmd
Decrement argument by one
Conditionally apply a statement to a value.
x
is being injected as the value.
Enum.drop
String.duplicate
Enum.each
Enum.group_by
elem
Enum.member?
Enum.take
Enum.filter
Enum.reject
Enum.find
Enum.find_index
Enum.flat_map
IO.ANSI.format
Shorter if
Increment argument by one
Enum.into
Enum.join
Map.keys
Keyword.get
Keyword.put
length
List.delete
List.first
List.last
Enum.map
Enum.max
Map.delete
Map.get
Enum.min
2 dimensional map
Map.put
Map.take
Map.update
Map with previous element
IO.puts
IO.write
Enum.reduce
Enum.reduce
Enum.reverse
String.length
String.split
Enum.sort
Enum.sort_by
String.slice
then
Matrix transpose
String.trim
Enum.uniq
Enum.unzip
Map.values
Enum.with_index
Enum.zip
Link to this section Functions
a(a, b)
Enum.at
all?(a, b)
Enum.all?
any?(a, b)
Enum.any?
atomize(d)
cc(a, b)
Enum.concat
cmd(a, b)
System.cmd
cmd(a, b, c)
dec(a)
Decrement argument by one
examples
Examples
iex> ProMode.dec(1) 0
Conditionally apply a statement to a value.
x
is being injected as the value.
iex> ProMode.do?([1], true, [2 | x]) [2, 1]
iex> ProMode.do?([1], false, [2 | x]) [1]
iex> ProMode.do?(1, x == 1, 2 * x) 2
iex> t = true; %{a: 1} |> ProMode.do?(t, Map.put(x, :b, 2)) |> ProMode.do?(false, Map.put(x, :c, 3)) |> ProMode.do?(true, Map.delete(x, :a)) %{b: 2}
iex> t = true; %{a: 1} |> ProMode.do?(t, Map.put(x, :b, 2)) %{a: 1, b: 2}
iex> t = false; %{a: 1} |> ProMode.do?(t, Map.put(x, :b, 2)) %{a: 1}
iex> v = 5; ProMode.do?([], v, ProMode.kwp(x, :count, v)) [count: 5]
iex> v = nil; ProMode.do?([], v, ProMode.kwp(x, :count, v)) []
drop(a, b)
Enum.drop
dup(a, b)
String.duplicate
e(a, b)
Enum.each
eg(a, b)
Enum.group_by
eg(a, b, c)
el(a, b)
elem
em(a, b)
Enum.member?
et(a, b)
Enum.take
f(a, b)
Enum.filter
f!(a, b)
Enum.reject
fd(a, b)
Enum.find
fdi(a, b)
Enum.find_index
fm(a, b)
Enum.flat_map
fmt(a)
IO.ANSI.format
fmt(a, b)
Shorter if
examples
Examples
iex> ProMode.i?(true, "then", "else") "then"
iex> ProMode.i?(false, "then", "else") "else"
iex> ProMode.i?(true, "yes") "yes"
iex> ProMode.i?(false, "yes") nil
inc(a)
Increment argument by one
examples
Examples
iex> ProMode.inc(1) 2
into(a, b)
Enum.into
into(a, b, c)
Enum.join
j(a, b)
keys(a)
Map.keys
kwg(a, b)
Keyword.get
kwp(a, b, c)
Keyword.put
length
ld(a, b)
List.delete
lf(a)
List.first
ll(a)
List.last
m(a, b)
Enum.map
max(a)
Enum.max
md(a, b)
Map.delete
mg(a, b)
Map.get
mg(a, b, c)
min(a)
Enum.min
mm(a, b)
2 dimensional map
examples
Examples
iex> ProMode.mm([[1, 2], [3, 4]], & &1 + 1) [[2, 3], [4, 5]]
mp(a, b, c)
Map.put
mt(a, b)
Map.take
mu(a, b, c, e)
Map.update
mwp(l, f)
Map with previous element
examples
Examples
Calculates deltas
iex> ProMode.mwp([1, 3, 10, 22], &-/2) [-2, -7, -12]
IO.puts
pr(a)
IO.write
r(a, b)
Enum.reduce
r(a, b, c)
Enum.reduce
rv(a)
Enum.reverse
sl(a)
String.length
split(a, b)
String.split
srt(a)
Enum.sort
srt(a, b)
srtb(a, b)
Enum.sort_by
srtb(a, b, c)
sslice(a, b)
String.slice
sslice(a, b, c)
t(a, b)
then
to_a(x)
to_f(x)
to_i(x)
to_s(x)
tpose(matrix)
Matrix transpose
examples
Examples
iex> ProMode.tpose([[1, 2], [3, 4]]) [[1, 3], [2, 4]]
trim(a)
String.trim
uniq(a)
Enum.uniq
unzip(a)
Enum.unzip
vals(a)
Map.values
wi(a)
Enum.with_index
zip(a, b)
Enum.zip