Merry Christmas

December 26th, 2008 by Chouser

Fractal Tree

In the beginning was the Word, and the Word was with God, and the Word was fully God. The Word was with God in the beginning. All things were created by him, and apart from him not one thing was created that has been created. In him was life, and the life was the light of mankind. And the light shines on in the darkness, but the darkness has not mastered it.

A man came, sent from God, whose name was John. He came as a witness to testify about the light, so that everyone might believe through him. He himself was not the light, but he came to testify about the light. The true light, who gives light to everyone, was coming into the world. He was in the world, and the world was created by him, but the world did not recognize him. He came to what was his own, but his own people did not receive him. But to all who have received him – those who believe in his name – he has given the right to become God’s children

-- John 1:1-12a, NET

The program to draw the tree is 30 lines of Clojure

6 Responses to “Merry Christmas”

  1. Jim Thompson says:

    I get:

    jim-thompsons-macbook-pro-15:~ jim$ clojure
    ~/clojure_20080916 ~
    Clojure
    user=> (. javax.swing.JOptionPane (showMessageDialog nil “Hello World”))
    nil
    user=> (import ‘(java.awt Point Graphics Frame) ‘(java.awt.geom AffineTransform))
    nil
    user=> (def minpoint (doto (Point.) (.setLocation 0 0)))
    java.lang.IllegalArgumentException: No matching method found: .setLocation
    [removed extra stack trace lines --Chouser]

  2. Chouser says:

    The syntax for ‘doto’ changed in late November. You may be able to make this code work by changing all (doto foo (.bar) (.qux)) to (doto foo (bar) (qux))

    But it may be easier to upgrade to a newer version of Clojure:
    http://code.google.com/p/clojure/downloads/list

  3. Jim Thompson says:

    Thanks. I’ve upgraded, but now its pulling a different error.

    15:~ jim$ clojure
    Clojure
    user=> (System/getProperties)
    [removed output --Chouser]
    user=> (load-file “../fractal.clj”)
    java.lang.Exception: No such var: user/condp (fractal.clj:14)

  4. Chouser says:

    It appears that condp was added shortly *after* the latest release.

    So you can either upgrade again to SVN version 1180 or later, or you can use this modified version of my code which I actually tested on Clojure release 20081217

    http://gist.github.com/51110

    Thanks for sticking with it!

  5. Jim Thompson says:

    That works. Thanks!

  6. Hello Chouser. I really enjoyed the slight differences in the translation you used. And the Daoist in me feels compelled to point out that your Christmas tree is very dark, and yet very good at the same time. A much belated Merry Christmas to you.

    I’m looking for a good email to send an invitation to you, to join the Souphouse Yahoo group…

Leave a Reply