<story><title>Comparing JavaScript, CoffeeScript &amp; ClojureScript</title><url>http://dosync.posterous.com/comparing-javascript-coffeescript-clojurescri</url></story><parent_chain></parent_chain><comment><author>jashkenas</author><text>One man&apos;s &quot;reusable abstraction&quot; is another man&apos;s &quot;why the hell is this thing being abstracted?&quot; ... perhaps with Lisps more than anywhere else ;)&lt;p&gt;For example, in David&apos;s final gist, we have:&lt;p&gt;&lt;pre&gt;&lt;code&gt;    (defprotocol ISlice
      (-shift [this]))

    (deftype Slice [start end]
      ISlice
      (-shift [_] (Slice. (inc start) (inc end)))
      IFn
      (-invoke [_ x]
        (cond
          (string? x) (.substring x start end)
          (vector? x) (subvec x start end))))

    (def s (Slice. 0 5))
    (def v [&quot;List Processing&quot; [0 1 2 3 4 5 6]])

    (map s v)
    ;; &amp;#62;&amp;#62; (&quot;List &quot; [0 1 2 3 4])
    (map (-shift s) v)
    ;; &amp;#62;&amp;#62; (&quot;ist P&quot; [1 2 3 4 5])
&lt;/code&gt;&lt;/pre&gt;
When I think there&apos;s a good case to be made for the clarity of this alternative:&lt;p&gt;&lt;pre&gt;&lt;code&gt;    slice = (start, end) -&amp;#62;
      (list) -&amp;#62;
        if typeof list is &apos;string&apos;
          list.substring start, end
        else
          list.slice start, end

    vector = [&quot;List Processing&quot;, [0, 1, 2, 3, 4, 5, 6]]

    vector.map slice 0, 5
    # [&quot;List &quot;,[0,1,2,3,4]]

    vector.map slice 1, 6
    # [&quot;ist P&quot;,[1,2,3,4,5]]
&lt;/code&gt;&lt;/pre&gt;
... but with careful compile-to-JS languages, it&apos;s pretty great that each can do it their own way, and the resulting code can play nicely together.</text></comment>
<story><title>Comparing JavaScript, CoffeeScript &amp; ClojureScript</title><url>http://dosync.posterous.com/comparing-javascript-coffeescript-clojurescri</url></story><parent_chain></parent_chain><comment><author>lazerwalker</author><text>I appreciated the look into ClojureScript as someone who&apos;s never touched it (and whose interest is definitely piqued now), but I&apos;m baffled by the article&apos;s initial hook of &apos;let&apos;s compare how many characters it takes to accomplish the same task&apos;. Is this really a meaningful metric? There&apos;s value in comparing the relative clarity and expressibility of each language, but that&apos;s not necessarily synonymous with brevity. I get that it&apos;s not the heart of the piece, but starting with such pedantry seems to detract from the point.</text></comment>