Talk:Sparkline in unicode: Difference between revisions

Content added Content deleted
m (→‎sparktest.pl: shorter still)
m (→‎sparktest.pl: shortened)
Line 19: Line 19:
This is some Perl code that will report the widths of same-height sections of output, when provided with a sparkline on standard input. Non-sparkline-lines are ignored. The line produced from a continuous integer sequence should produce eight equal widths (or almost equal if the sequence length is not a multiple of eight).
This is some Perl code that will report the widths of same-height sections of output, when provided with a sparkline on standard input. Non-sparkline-lines are ignored. The line produced from a continuous integer sequence should produce eight equal widths (or almost equal if the sequence length is not a multiple of eight).


<code> perl -CS -Mutf8 -nle 'y/▁-█//cd; @x=grep $i^=1, map length, /((.)\2*)/g and print"@x"' </code>
<code> perl -CS -Mutf8 -nle '@x=grep $i^=1, map length, /(([▁-█])\2*)/g and print"@x"' </code>


Sample usage (in bash, and assuming program accepts space-separated data on standard input):
Sample usage (in bash, and assuming program accepts space-separated data on standard input):