Array types in multimethod?

2010-10-18 Thread stefanmuenchow
Hey :) I have a little problem defining a multimethod with an array type as parameter. I have something like this: (defmulti amethod (fn [& args] (vec (map class args (defmethod amethod [[C] ([par1] (String. par1))) I want to pass a char-array as parameter. The internal java name i "[C",

Re: Macro expansion problem

2010-09-27 Thread stefanmuenchow
Thanks for your reply :) The context: I am developing a wrapper generator that takes a Java class and generates a Clojure wrapper, with a function for each method etc. The purpose is to have nice wrappers, so your code is "cleaner" as with all that Java calls. And it can ba a basis for more conven

Macro expansion problem

2010-09-27 Thread stefanmuenchow
I am a macro newbie... I want to create a macro that calls a function with a given name and a parameter list on a given object. My first idea was like this: (defmacro call "Calls an instance method on a given object with a list of params." [obj method-name params] `(. ~obj ~(symbol method-na

Problem with simple gui

2010-03-08 Thread stefanmuenchow
I tried to build a Swing gui with Clojure and get an error I don't understand. Perhaps it's more a swing-problem than a clojure-problem, but I'm sure the solution is simple and someone here will know the answer. I have two frames, one serves as the main-window of the app and the second one opens i

When to use loop recur / seq functions?

2010-02-15 Thread stefanmuenchow
Hello, I'm new to clojure and have a question concerning recur and lazy seqs. I implemented a function to calculate the perimeter of a polygon. As I'm used to Java and imperative programming, my first approach was to use loop/recur ('euclidean-distance' is a helper-function that calculates the dis