Sparkline in unicode: Difference between revisions

Content added Content deleted
Line 23:
{{incomplete|APL|Examples from task?}}
Note → this is in a 0-indexed version of APL
'''Solution''':<lang APL> sparkln←{'▁▂▃▄▅▆▇█'[⌈7×⍵÷⌈⌊0.5+7×⍵÷⌈/⍵]}</lang>
'''Example''':<lang APL> sparkln 1 2 3 4 5 6 7 8 7 6 5 4 3 2 1
sparkln 1 2 3 4 5 6 7 8 7 6 5 4 3 2 1
▁▂▃▄▅▆▇▇▇▆▅▄▃▂▁
▂▃▄▅▅▆▇█▇▆▅▅▄▃▂
sparkln 1.5, 0.5 3.5, 2.5 5.5, 4.5 7.5, 6.5
▂▁▄▃▆▅█▇
▂▁▄▃▆▅▇▇
</lang>
Note → APL accepts the input with commas and spaces naturally. If one wanted to read input as a string they could use ⍎⍞ to do so.