Clojure Notes--Cdt, Piccolo 1

Context: installing the Emacs front-end for the Clojure Development Kit installation (see

I'm having some trouble with the installation, especially with getting Leiningen to pull in its dependencies. I had just been using git and was in the git-bash shell. For some reason, things weren't working—I got a "No such file or directory" error for lein. I tried the same thing from a Windows shell and it worked just fine.

Context: Beginning use of mozinator's clj-piccolo2d Clojure "wrapper" for piccolo2d graphics library (see and, respectively)

I started with a working program and began changing things, one by one. In the two lines below, the first method works, while the second method doesn't:

;  (:use clj-piccolo2d.core))
  (:use '[clj-piccolo2d.core :only (rectangle add! width height)]))

The error message from using the uncommented line above is as follows:

C:\tech\cljprojects\piccolotest1>lein run piccolotest1.core
lein run piccolotest1.core
Exception in thread "main" java.lang.Exception: lib names inside prefix lists
must not contain periods (core.clj:15)

According to (just before time mark 6:50), the error comes from the fact that symbols cannot currently contain periods in them.

For the moment, I'll go back to using the simpler :use statement.


An example of destructuring in the argument list (ignore the function names):

(defn make-PText
  "Make a PText object w/optional text, font"
  [& [text font]]
  (println "text=" text ", font=" font))

(make-PText "hello" (make-font "Monospaced" Font/PLAIN 36))
(make-PText "hello")

The three tests return the following:

text= hello , font= #<Font java.awt.Font[family=Monospaced, 
text= hello , font= nil
text= nil , font= nil

Note that if the value expected within the arg sequence doesn't exist, the value returned is nil.

Unless otherwise stated, the content of this page is licensed under Creative Commons Attribution-ShareAlike 3.0 License