Note that there are some explanatory texts on larger screens.

plurals
  1. PO
    text
    copied!<p>I don't think there's any such thing as intrinsic readability. There's what you're used to, and what you aren't used to. I was able to read both versions of your code OK. I could actually read your Groovy version more easily, even though I don't know Groovy, because I too spent a decade looking at C and Java and only a year looking at Clojure. That doesn't say anything about the languages, it only says something about me.</p> <p>Similarly I can read English more easily than Spanish, but that doesn't say anything about the intrinsic readability of those languages either. (Spanish is actually probably the "more readable" language of the two in terms of simplicity and consistency, but I still can't read it). I'm learning Japanese right now and having a heck of a hard time, but native Japanese speakers say the same about English.</p> <p>If you spent most of your life reading Java, of course things that look like Java will be easier to read than things that don't. Until you've spent as much time looking at Lispy languages as looking at C-like languages, this will probably remain true.</p> <p>To understand a language, among other things you have to be familiar with:</p> <ul> <li>syntax (<code>[vector]</code> vs. <code>(list)</code>, <code>hyphens-in-names</code>)</li> <li>vocabulary (what does <code>reductions</code> mean? How/where can you look it up?)</li> <li>evaluation rules (does treating functions as objects work? It's an error in most languages.)</li> <li>idioms, like <code>(map first (some set of reductions with extra accumulated values))</code></li> </ul> <p>All of these take time and practice and repetition to learn and internalize. But if you spend the next 6 months reading and writing lots of Clojure, not only will you be able to understand that Clojure code 6 months from now, you'll probably understand it better than you do now, and maybe even be able to simplify it. How about this:</p> <pre><code>(use 'clojure.contrib.seq-utils) ;;' (defn positions [coll] (mapcat #(repeat (count %) (inc (ffirst %))) (partition-by second (indexed coll)))) </code></pre> <p>Looking at Clojure code I wrote a year ago, I'm horrified at how bad it is, but I can read it OK. (Not saying your Clojure code is horrible; I had no trouble reading it at all, and I'm no guru.)</p>
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload