Arc Forumnew | comments | leaders | submitlogin
2 points by fallintothis 6007 days ago | link | parent

My Perl knowledge is wanting, but presuming that that snippet reads from standard input, you could do the same with Arc:

  (counts:tokens:drain:readc:stdin)
However, I am of the mind that string-based reading is so common that there really should be equivalent functions. Things like 'readfile use 'read to collect all the s-expressions in a file, but not the text -- there's not a 'readc variant of 'readfile. If 'readfile used 'readc instead (or you defined such a function), you could reduce the problem to something like

  (counts:tokens:readfile "filename")
which is far more readable, and shorter besides.

These snippets, of course, don't exercise the same sorts of syntactic compactness that the Perl demonstrates, instead relying more on existing library functions. So it goes with these sorts of comparisons.