> Can you let the fn call figure that out for you? Like so:
>
> (apply (fn ([p1 p2] (new Connection.Configuration p1 p2))
> ([p1 p2 p3] (new Connection.Configuration p1 p2 p3)))
> params)
>
> I realize that reflection is probably better in this case, but was
> wonderi
Ah, makes sense now, thank you. I know the parameter list will be one of
three possibilities, so probably makes more sense to specify the conditions
than to use reflection. I don't have a repl handy, but either of the below
should work:
;; using apply (per Konrad)
(cond
(= (count params) 2)
On 2 Jun 2010, at 21:10, Mike Meyer wrote:
If your class has multiple constructors with different arity, there
are ways to look up the right constructor using reflection, but I
have forgotten the details already.
Can you let the fn call figure that out for you? Like so:
(apply (fn ([p1
On Wed, 2 Jun 2010 13:33:30 +0200
Konrad Hinsen wrote:
> Constructors calls translate directly to Java constructor calls, meaning that
> the number of arguments must be known at compile time.
>
> Assuming your constructor takes a fixed number of arguments, the easiest
> solution to your proble
Hi,
On Jun 2, 2:51 am, Mark Rathwell wrote:
> ;; can do it with eval, but what is the correct way?
> user=> (eval `(ConnectionConfiguration. ~...@params))
> (eval `(ConnectionConfiguration. ~...@params))
> # org.jivesoftware.smack.connectionconfigurat...@a0430b6>
The best way is to use reflecti
On 02.06.2010, at 02:51, Mark Rathwell wrote:
> I apologize for my ignorance, I've been struggling with this one for a couple
> hours and can't figure it out. Why does apply not work with constructors,
> special forms, etc.? Is there some other standard way to unpack a list? My
> question is
I apologize for my ignorance, I've been struggling with this one for a
couple hours and can't figure it out. Why does apply not work with
constructors, special forms, etc.? Is there some other standard way to
unpack a list? My question is outlined below, I have a variable length list
of paramete