Jump to content

Sparkline in unicode: Difference between revisions

Line 24:
Note → this is in a 0-indexed version of APL
'''Solution''':<lang APL> sparkln←{'▁▂▃▄▅▆▇█'[⌈7×⍵÷⌈/⍵]}</lang>
'''Example''':<lang APL> sparkln 1, 2, 3 4 5 6 7 18 7 6 5 4 3 2 1
▁▂▃▄▅▆▇▇▇▆▅▄▃▂▁
▂▃█▂▆</lang>
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.
 
Anonymous user
Cookies help us deliver our services. By using our services, you agree to our use of cookies.