Sparkline in unicode: Difference between revisions
Content added Content deleted
Line 24:
Note → this is in a 0-indexed version of APL
'''Solution''':<lang APL> sparkln←{'▁▂▃▄▅▆▇█'[⌈7×⍵÷⌈/⍵]}</lang>
'''Example''':<lang APL> sparkln 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.
|