Re: I'm doing something wrong with gen-class

2011-01-28 Thread Andy Fingerhut
And if anyone is curious, I've now got a Clojure program that works pretty much exactly like this Java program, including using gen-class to extend java.io.ByteArrayOutputStream with a new method, and access two protected (non-static) fields of the superclass: http://shootout.alioth.debian.

Re: I'm doing something wrong with gen-class

2011-01-28 Thread Andy Fingerhut
That was what I was missing. Thanks, Aaron. Regarding using :gen-class in the ns macro, and also (gen-class) at the top level, I am using the first because I know it works for AOT compilation (important for the shootout web site to avoid measuring compilation as part of the run time). If

Re: I'm doing something wrong with gen-class

2011-01-28 Thread Aaron Cohen
On Fri, Jan 28, 2011 at 6:13 PM, Andy Fingerhut wrote: >> (ns andy.try >>  (:gen-class)) >> >> (gen-class >> :name  andy.try.ReversibleByteArray >> :prefix rba-) I find it confusing that you have both of ":gen-class in the ns macro" (I guess you're using this to get -main) and "(gen-class) at th

Re: I'm doing something wrong with gen-class

2011-01-28 Thread Carson
Haven't tried this, but some ideas/questions in my mind: Is it not better to use the (:gen-class :name ... :prefix ...) inside (ns) instead of having a separate (gen-class ...) outside (ns ...)? Maybe it makes no difference? (dunno, but the documentation for ns suggests otherwise) Where y

Re: I'm doing something wrong with gen-class

2011-01-28 Thread Andy Fingerhut
Woops. I meant to have both occurrences of (rba-reverse) in defn -main replaced with just (reverse). I made that replacement, and still get nearly the same error message: Exception in thread "main" java.lang.IllegalArgumentException: No matching method found: reverse for class andy.try.R

Re: I'm doing something wrong with gen-class

2011-01-28 Thread Andy Fingerhut
Thanks for the suggestion. I'm not sure I implemented it correctly. Still no joy. Here is exactly what I tried: % ls -R andy ./andy: try.clj % cat andy/try.clj (ns andy.try (:gen-class)) (gen-class :name andy.try.ReversibleByteArray :prefix rba-) (defn rba-reverse [this] (println

Re: I'm doing something wrong with gen-class

2011-01-28 Thread Ken Wesson
On Fri, Jan 28, 2011 at 5:20 PM, Andy Fingerhut wrote: > -- > (ns try >  (:gen-class)) Try using a two-component (or more) namespace name. I think gen-class in a one-component namespace will try to create the class in the default

I'm doing something wrong with gen-class

2011-01-28 Thread Andy Fingerhut
Sigh. Sorry, I'm not an experienced Java developer, and I'm sure there are basic things relating Java packages, directories in classpaths, and Clojure hierarchical namespaces that I just don't have in my head yet. Right now I feel like I'm banging my head against a wall and not getting an