[aklug] OT: Clojure help

Christopher Howard christopher.howard at qlfiles.net
Fri May 26 05:07:28 AKDT 2017


Is there a Clojure programmer on one of these lists who wouldn't mind
corresponding with a Clojure n00b to answer a few basic questions? Here
is the first one:

When I run

tutorial.core> (let [img (new-image 32 32)] (set-pixel img 10 10 cyan)
(show img))

from the REPL, this returns a javax.swing.JFrame object, and displays
the frame and image as expected. However, if put the same in

(defn -main
  "Generates image."
  [& args]
  (let [img (new-image 32 32)]
    (set-pixel img 10 10 cyan)
    (show img)))

in more core.clj, and run (-main) from the REPL, I get error

ClassCastException java.awt.image.BufferedImage cannot be cast to
clojure.lang.IFn  tutorial.core/-main (core.clj:11)

Why the difference?

--
https://qlfiles.net


More information about the aklug mailing list