Trying to get the ants demo to run on Windows

9 views
Skip to first unread message

Rob Hansford

unread,
Nov 19, 2008, 4:54:59 PM11/19/08
to Clojure
Hi all,
I'm new to clojure and I've just been trying to get the ants demo from
the video lectures to work. I presume I've done something wrong
because I get a screen full of errors when I load in the ants.clj file
(pasted below). I tried copying and pasting the code in bit by bit
(if I paste too much in one go I get errors), and the errors come from
the definition of setup (lines 58 to 70). I also get errors from the
definition of panel (lines 283 to 287) which I've also pasted below.
Can anyone tell me what I've done wrong? I got clojure from the
sourceforge .zip file download, and I installed the Java 6 update 10
JDK from the link on the 'getting started' page, and I'm running it
from a cmd prompt on windows XP SP2.

Thanks

Rob.

=================================================================

D:\Downloads\clojure\clojure_20080916>java -cp clojure.jar
clojure.lang.Repl
Clojure
user=> (load-file "../ants.clj")
java.lang.IllegalArgumentException: recur arg for primitive local:
G__2315 must
be matching primitive
clojure.lang.Compiler$CompilerException: ants.clj:61:
java.lang.IllegalArgumentE
xception: recur arg for primitive local: G__2315 must be matching
primitive
at clojure.lang.Compiler.analyzeSeq(Compiler.java:3865)
at clojure.lang.Compiler.analyze(Compiler.java:3698)
at clojure.lang.Compiler.analyzeSeq(Compiler.java:3848)
at clojure.lang.Compiler.analyze(Compiler.java:3698)
at clojure.lang.Compiler.analyze(Compiler.java:3671)
at clojure.lang.Compiler.access$100(Compiler.java:37)
at clojure.lang.Compiler$HostExpr$Parser.parse(Compiler.java:
734)
at clojure.lang.Compiler.analyzeSeq(Compiler.java:3858)
at clojure.lang.Compiler.analyze(Compiler.java:3698)
at clojure.lang.Compiler.analyzeSeq(Compiler.java:3848)
at clojure.lang.Compiler.analyze(Compiler.java:3698)
at clojure.lang.Compiler.analyze(Compiler.java:3671)
at clojure.lang.Compiler.access$100(Compiler.java:37)
at clojure.lang.Compiler$BodyExpr$Parser.parse(Compiler.java:
3384)
at clojure.lang.Compiler$FnMethod.parse(Compiler.java:3231)
at clojure.lang.Compiler$FnMethod.access$1200(Compiler.java:
3142)
at clojure.lang.Compiler$FnExpr.parse(Compiler.java:2766)
at clojure.lang.Compiler.analyzeSeq(Compiler.java:3856)
at clojure.lang.Compiler.analyze(Compiler.java:3698)
at clojure.lang.Compiler.analyzeSeq(Compiler.java:3848)
at clojure.lang.Compiler.analyze(Compiler.java:3698)
at clojure.lang.Compiler.access$200(Compiler.java:37)
at clojure.lang.Compiler$DefExpr$Parser.parse(Compiler.java:
343)
at clojure.lang.Compiler.analyzeSeq(Compiler.java:3858)
at clojure.lang.Compiler.analyze(Compiler.java:3698)
at clojure.lang.Compiler.analyzeSeq(Compiler.java:3848)
at clojure.lang.Compiler.analyze(Compiler.java:3698)
at clojure.lang.Compiler.analyze(Compiler.java:3671)
at clojure.lang.Compiler.eval(Compiler.java:3895)
at clojure.lang.Compiler.load(Compiler.java:4196)
at clojure.lang.Compiler.loadFile(Compiler.java:4163)
at clojure.lang.RT$3.invoke(RT.java:289)
at user.eval__2290.invoke(Unknown Source)
at clojure.lang.Compiler.eval(Compiler.java:3891)
at clojure.lang.Repl.main(Repl.java:75)
Caused by: java.lang.RuntimeException:
java.lang.IllegalArgumentException: recur
arg for primitive local: G__2315 must be matching primitive
at clojure.lang.Compiler$RecurExpr.emit(Compiler.java:3598)
at clojure.lang.Compiler$BodyExpr.emit(Compiler.java:3414)
at clojure.lang.Compiler$IfExpr.emit(Compiler.java:2264)
at clojure.lang.Compiler$BodyExpr.emit(Compiler.java:3414)
at clojure.lang.Compiler$LetExpr.emit(Compiler.java:3542)
at clojure.lang.Compiler$BodyExpr.emit(Compiler.java:3414)
at clojure.lang.Compiler$LetExpr.emit(Compiler.java:3534)
at clojure.lang.Compiler$BodyExpr.emit(Compiler.java:3414)
at clojure.lang.Compiler$LetExpr.emit(Compiler.java:3542)
at clojure.lang.Compiler$BodyExpr.emit(Compiler.java:3414)
at clojure.lang.Compiler$LetExpr.emit(Compiler.java:3542)
at clojure.lang.Compiler$BodyExpr.emit(Compiler.java:3411)
at clojure.lang.Compiler$FnMethod.emit(Compiler.java:3255)
at clojure.lang.Compiler$FnExpr.compile(Compiler.java:3013)
at clojure.lang.Compiler$FnExpr.parse(Compiler.java:2807)
at clojure.lang.Compiler.analyzeSeq(Compiler.java:3856)
... 34 more
Caused by: java.lang.IllegalArgumentException: recur arg for primitive
local: G_
_2315 must be matching primitive
at clojure.lang.Compiler$RecurExpr.emit(Compiler.java:3593)
... 49 more
user=>

==========================================================

user=>
(def panel (doto (proxy [JPanel] []
(paint [g] (render g)))
(.setPreferredSize (new Dimension
(* scale dim)
(* scale dim)))))
java.lang.IllegalArgumentException: No matching method
found: .setPreferredSize
java.lang.IllegalArgumentException: No matching method
found: .setPreferredSize
at clojure.lang.Reflector.invokeMatchingMethod(Reflector.java:
44)
at clojure.lang.Reflector.invokeInstanceMethod(Reflector.java:
28)
at user.fn__2524.invoke(Unknown Source)
at clojure.lang.AFn.applyToHelper(AFn.java:182)
at clojure.lang.AFn.applyTo(AFn.java:175)
at clojure.lang.Compiler$InvokeExpr.eval(Compiler.java:2589)
at clojure.lang.Compiler$DefExpr.eval(Compiler.java:282)
at clojure.lang.Compiler.eval(Compiler.java:3896)
at clojure.lang.Repl.main(Repl.java:75)

mb

unread,
Nov 20, 2008, 2:23:34 AM11/20/08
to Clojure
Hi,

there were some breaking changes in the SVN head lately
in preparation of v1.0. Rich updated the ants demo some
days, ago. So maybe you now have the new demo with the
"old" clojure. I got the demo working without problems before
the changes.

Sincerely
Meikel

Blaine

unread,
Nov 29, 2008, 12:51:41 PM11/29/08
to Clojure
Hi there,

I'm having almost the same problem. I'm trying to get the ants demo
running in ubuntu, and I get Rob's second problem:

user=> (def panel (doto (proxy [JPanel] []
(paint [g] (render g)))
(.setPreferredSize (new Dimension
(* scale dim)
(* scale dim)))))
java.lang.IllegalArgumentException: No matching method
found: .setPreferredSize for class clojure.lang.Proxy__203
(NO_SOURCE_FILE:7)

The rest of the file loads - if I run clojure from within slime I can
individually compile the rest of the defns. (That said, I can no
longer start clojure from within slime. After updating clojure it
stopped working.)

I'm at revision 1128 for clojure.

I'm new to Java, so is it possible that I don't have some Swing/AWT
thing installed? No complaint from:

user=> (import
'(java.awt Color Graphics Dimension)
'(java.awt.image BufferedImage)
'(javax.swing JPanel JFrame))
nil

And, the java version, in case that's relevant:

blaino@blaino-dell:~$ java -version
java version "1.6.0_07"
Java(TM) SE Runtime Environment (build 1.6.0_07-b06)
Java HotSpot(TM) Client VM (build 10.0-b23, mixed mode, sharing)


Any ideas?

Thanks,
Blaine

Blaine

unread,
Nov 30, 2008, 9:15:03 AM11/30/08
to Clojure
I feel really stupid - I'm pretty sure I just forgot to build.
Anyhow, the ant simulation works perfectly (ubuntu, clojure revision
1131). It's real cool. Sure is alot going on with just 200 or so
lines of codes.
Reply all
Reply to author
Forward
0 new messages