Update all new Tasks
This commit is contained in:
parent
00a190b0a6
commit
91df62d461
5697 changed files with 93386 additions and 804 deletions
|
|
@ -0,0 +1,8 @@
|
|||
defmodule RC do
|
||||
def sparkline(str) do
|
||||
values = str |> String.split(~r/(,| )+/)
|
||||
|> Enum.map(&(elem(Float.parse(&1), 0)))
|
||||
{min, max} = {Enum.min(values), Enum.max(values)}
|
||||
IO.puts Enum.map(values, &(round((&1 - min) / (max - min) * 7 + 0x2581)))
|
||||
end
|
||||
end
|
||||
|
|
@ -0,0 +1,6 @@
|
|||
str1 = "1 2 3 4 5 6 7 8 7 6 5 4 3 2 1"
|
||||
str2 = "1.5, 0.5 3.5, 2.5 5.5, 4.5 7.5, 6.5"
|
||||
|
||||
RC.sparkline(str1)
|
||||
IO.puts "" # newline
|
||||
RC.sparkline(str2)
|
||||
Loading…
Add table
Add a link
Reference in a new issue