Data commit
This commit is contained in:
parent
7387c8f97b
commit
cb5bb5e222
199093 changed files with 3378972 additions and 0 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_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