4 ms·
It is both strictly correct and irrelevant to the topic at hand that the Lisp is easier to read. Because that's like saying "Lisp sucks because WTF does 'cddadr
by wanorris 15y ago
It is both strictly correct and irrelevant to the topic at hand that the Lisp is easier to read. Because that's like saying "Lisp sucks because WTF does 'cddadr' mean anyway?"
AWK is a purpose-built language for splitting lines into fields and doing stuff with the result, so of course there's not a lot of boilerplate for splitting lines into fields and doing stuff with the results.
Lisp for doing a lot of fancy work with s-expressions is going to be high density code that's a lot harder for newcomers to read than verbose, plodding Java code that is working with a simple LinkedList class or something.
Readability (Edit: to newcomers) just isn't the relevant benchmark here.
- tikhonj 15y agoI don't think a linked list in Java is a good example. I took two CS intro courses in a row last year; the first one used Scheme and the second one concentrated on data structures and used Java. There were some completely inexperienced people taking the two courses along with me. As far as I could tell they had much more difficulty with linked lists and trees in Java, which made them needlessly complex, than they did in Scheme. And this is with people who had actually learned about both concepts first in Scheme, so they had more experience when they came to Java.
- wanorris 15y agoFair point. Perhaps I picked a bad example. At the same time, if you were writing a bunch of random awk-like one-offs as part of your normal lisp workflow, you wouldn't write 4 lines of code every time, right? You sit down and write some functions or macros that condensed it into something simple that allowed you to easily specify things like a split token, one or more filter-on fields and values (or better, a filter lambda), and one or more output fields, I bet. Because it's silly to write several lines for something you do a lot. And while you might call it process-file-and-return-matching-results or something, the interface to the result might not be so different from the line of awk in the original post.