holman / spark

▁▂▃▅▂▇ in your shell.

Home Page:http://zachholman.com/spark/

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Accept multiple delimiters

gwern opened this issue · comments

The example uses of spark spend a lot of time munging input into the exact comma-delimited form spark demands. Seems like a waste. And many of the spark clones use different delimiters. Why not just accept all forms of white-space as delimiters? Space, newline, tab - everyone will want one of them eventually.

(If you wanted to get really crazy, you could probably do something to accept any delimiter by parsing runs of consecutive numbers: '10xyz5xyz5.0xyz485xyz' etc. But I'm not actually suggesting you do that unless you think it's awesome.)

I was thinking the same thing as I was writing those examples.

Kaboom, #27.

So that's just supporting spaces? What about tabs or newlines? Newlines would be helpful for #9, inasmuch as HEAD spark now only reads one line:

[02:35 PM] 145Mb$ echo -e 1\n5\n6\n10\n15\n10\n11\n4 | spark

vs

[02:34 PM] 145Mb$ spark 1 5 6 10 15 10 11 4
▁▃▃▅▅▆▂

I'd dig having tabs and newlines too (newlines in particular).

That shouldn't be too hard, especially since you're already using tr to handle one form of whitespace - just use one of the more general character classes tr defines.