This weekend in the Intertweets (Dec 20th Ed)

  • Pre/Post conditions for functions coming in #clojure 1.1 (here, via @thebusby)
  • (defn constrained-sqr [x]
        {:pre  [(pos? x)]
         :post [(> % 16), (< % 225)]}
        (* x x))
  • #clojure promise function implementation is 10 lines! (here, via @wmacgyver)
  • (defn promise
      "... (edited) ..."
      []
      (let [d (java.util.concurrent.CountDownLatch. 1)
            v (atom nil)]
        (proxy [clojure.lang.AFn clojure.lang.IDeref] []
          (deref [] (.await d) @v)
          (invoke [x]
            (locking d
              (if (pos? (.getCount d))
                (do (reset! v x)
                    (.countDown d)
                    this)
                (throw (IllegalStateException. "Multiple deliver calls to a promise"))))))))
  • Tail-call implementation for the JVM (here, via @mikedouglas) — a patch to the JVM source code that would provide TCI… if this patch exists and it works, does this mean we will see TCI in the JVM in our lifetime?
  • Tutorial: Continuation Monad in Clojure (here, via @timbray) — If you understand monads, then I guess you’ll find this tutorial ‘easy’.
  • The Parenophobes strike again (here, via @kotarak) — A defense of the lisp syntax from repeated attacks. Speaking to deaf ears maybe? Nonetheless, a good article.
  • Finally completely automated process of setting up Clojure, clojure-contrib, and vimclojure on new Linux installs (here, via @jakemcc) —  Related blog posts about how the scripts work here, here and here.
  • Setting up #Clojure, #Incanter, Emacs, Slime, Swank, and Paredit (here, via @liebke) — “I’ll be demonstrating how to build and install Incanter (which includes Clojure and Clojure-contrib), and then set up a development environment with Emacs, Slime, Swank, and Paredit.”
  • Adder: Python with a Lisp: lisp-1 compiled to #python bytecode like #clojure (here, via @jneira) — so, for when a clojure that runs on the python VM?
    • From the project page: “Clojure has prepared the ground for the notion of a Lisp that integrates into an existing language” (via @stuartsierra)
  • The Arc Challenge from a Clojure perspective (here, via @laujensen) — While showing how Clojure is a very terse language by comparing it to Paul Graham’s Arc (and as a response to Paul Graham’s challenge), Lau produces a web application that is the best example of the use of Compojure that I have seen so far (best as in smallest but complete)
  • Unit testing in Clojure (here, via @aberant) — I must have missed this one in November, but this is a nice tutorial on creating and running unit tests in clojure.
  • Mapping OOPS concepts to Clojure? Doable or Wrong thinking? (here, via @ajlopez) — Walking into a hornets’ nest, maybe?

2 Comments to “This weekend in the Intertweets (Dec 20th Ed)”

  1. Ian Phillips 28 December 2009 at 10:01 am #

    You seem to be turning the deref reader macro (@) into a twitter username link in the second code example.

    Also, r.e. tail-calls on the JVM: possibly, but it would need more that just a working implementation as there are some serious implications for the JVM security model related to eliding/eliminating stack frames. I wouldn’t count on seeing anything in JDK 7, but in the 8 time-frame, who knows?

  2. tbatchelli 28 December 2009 at 10:26 am #

    Thanks for the tip on the deref macro/twitter link issue. I use a wordpress plugin to automatically convert forms like “@name” into the correspondent twitter link, but of course it should not be affecting code. I’ll look into fixing it soon.

    I would agree on the fact that there is a long way to go before TCO appears on the JVM, if it ever does. The JVM is very widely used so I am sure there are a lot of regression test to run, both functional test and performance tests. Regardless, it is good to see someone got the ball running :)


Leave a Reply