For me it is difficult because I tend to translate OO in functional and
functional in OO. But I am starting to think differently. I guess I am at
point where my knowledge can hurt me for learning something new.
I am glad that the community is so responsive. This is great! :-)
Le jeudi 21 mai 20
It would probably be good to have a better example of what you are trying
to accomplish. Chances are with a few small tweaks we can help you find
something both elegant and fast.
On Thu, May 21, 2015 at 1:28 AM, martin madera wrote:
> I don't want to start a flamewar here, but Python is quite a
I don't want to start a flamewar here, but Python is quite a different
beast than Java or Clojure. TBH Python is more complex language than
Clojure but many things were made easy in Python and Python looks like that
someone really thought about newbie experience. A newbie experience in
Clojure
I love to program in Python and when you want do something in Python it is
usually easy. This makes your imagination powerful. Sad to see it is not
the same in Java.
Le mercredi 20 mai 2015 23:17:56 UTC-4, Andy Fingerhut a écrit :
>
> Java interop _with method names known at compile time_ is pre
Java interop _with method names known at compile time_ is pretty simple,
and is the most common case I have seen.
Why do you think it is supposed to be simple to select Java methods based
upon the values of variables at run time?
Andy
On Wed, May 20, 2015 at 7:31 PM, Pierre Thibault wrote:
> T
This is working well. It is pretty complex to do something that is suppose
to be simple. I am not yet able to understand this code. I find Clojure
hard to learn.
Thank you Keith.
Le mercredi 20 mai 2015 21:36:02 UTC-4, Keith Irwin a écrit :
>
> What about eval?
>
> user => (eval `(. ~(resolve
What about eval?
user => (eval `(. ~(resolve (symbol "String")) ~(symbol "format") "%s"
(to-array ["adasd"])))
“adasd"
I have a function form:
(defn static-invoke
[c meth & args]
(eval `(. ~(resolve (symbol c)) ~(symbol meth) ~@args)))
Which works for some things:
user => (static-invoke
Macros won't work because they are expanded at compile-time. We want to
choose the method at runtime.
Thanks,
Ambrose
On Thu, May 21, 2015 at 9:02 AM, Keith Irwin wrote:
> Not sure if this helps, but:
>
> user => (eval (symbol "Math" "PI”))
> 3.141592653589793
>
> user => (eval `(. ~(resolve (
Not sure if this helps, but:
user => (eval (symbol "Math" "PI”))
3.141592653589793
user => (eval `(. ~(resolve (symbol "String")) ~(symbol "format") "%s"
(to-array ["adasd"])))
“adasd"
Maybe a macro of some sort?
(defmacro invoke-static
[c meth & args]
`(. ~(resolve (symbol c)) ~(symbol m
Yes, you must use Java reflection.
Thanks,
Ambrose
On Thu, May 21, 2015 at 7:54 AM, Pierre Thibault wrote:
> I gave it a try:
>
> (.. (class String) (getMethod "format" (into-array Class [String
> (Class/forName "[Ljava.lang.Object;")])))
>
> But I am unable to get the method. I gave up.
>
>
>
I gave it a try:
(.. (class String) (getMethod "format" (into-array Class [String
(Class/forName "[Ljava.lang.Object;")])))
But I am unable to get the method. I gave up.
Le mercredi 20 mai 2015 19:12:05 UTC-4, Pierre Thibault a écrit :
>
> Hi Laurens,
>
> My example was not very good. Here anot
Hi Laurens,
My example was not very good. Here another one:
(.format (first '(String)) "%s" "foo")
Imagine String is obtained dynamically. I guess then I have to use Java
reflection to do a dynamic invocation. I guess I am confused because
classes in Java are not objects.
Le mercredi 20 mai 2
Hi Pierre,
> On May 20, 2015, at 3:38 PM, Pierre Thibault
> wrote:
>
> I can do Math/PI put how can I access PI if Math is in a expression like
> '(Math) for example?
Can you provide a more specific example? Math/PI is always Math/PI, it doesn’t
change if you put it in a nested form/expressi
I can do Math/PI put how can I access PI if Math is in a expression like
'(Math) for example?
--
You received this message because you are subscribed to the Google
Groups "Clojure" group.
To post to this group, send email to clojure@googlegroups.com
Note that posts from new members are moderated
Thanks for clarification.
-Brent
On Sep 18, 1:00 pm, Chas Emerick wrote:
> Not quite; fields without an access modifier are package-private. That means
> that code in classes in the same package (here, `clojure.lang`) can access
> such fields without any issue.
>
> The distinction is without
Not quite; fields without an access modifier are package-private. That means
that code in classes in the same package (here, `clojure.lang`) can access such
fields without any issue.
The distinction is without a difference for you here, of course — especially
since Clojure treats all package-p
Figured it out, those fields are private. Just reading the source code
I didn't realize if you don't declare it public, it defaults to
private. Shows how much I know about java syntax...
-Brent
On Sep 18, 10:22 am, Brent Millare wrote:
> Using 1.3.0-RC0
> I can't seem to access clojure.lang.Dyna
Using 1.3.0-RC0
I can't seem to access clojure.lang.DynamicClassLoader's public static
fields. Is there something else preventing me from doing this?
;user=> clojure.lang.DynamicClassLoader/classCache
CompilerException java.lang.RuntimeException: Unable to find static
field: classCache in class cl
There's already a miglayout wrapper in contrib. It seemed usable when
I looked at it.
On Jun 22, 7:35 am, Laurent PETIT wrote:
> Hi,
>
> BTW, if it can be an option for you, there's also the MigLayout layout
> manager (http://www.miglayout.com/) that allows to write constraints
> as Strings. It
Hi,
BTW, if it can be an option for you, there's also the MigLayout layout
manager ( http://www.miglayout.com/ ) that allows to write constraints
as Strings. It has already been mentioned on this ml, so maybe there's
clojure stuff done for integrating it more closely with clojure ?
HTH,
--
Lau
Thanks! Seems I forgot java.lang.reflect exists when I wrote that.
On Wed, Jun 17, 2009 at 4:47 PM, Michael Reid wrote:
>
> On Mon, Jun 15, 2009 at 9:13 AM, Parth wrote:
> >
> >
> >
> > On Jun 15, 7:08 am, James Koppel wrote:
> >> I am trying to write a function to simplify working with
> GridB
On Mon, Jun 15, 2009 at 9:13 AM, Parth wrote:
>
>
>
> On Jun 15, 7:08 am, James Koppel wrote:
>> I am trying to write a function to simplify working with GridBagConstraints
>> -- that is, instead of writing
>>
>> (let [c (GridBagConstraints.)]
>> (set! (.weightx c) 2.0)
>> (set! (.gridwid
On Jun 15, 7:08 am, James Koppel wrote:
> I am trying to write a function to simplify working with GridBagConstraints
> -- that is, instead of writing
>
> (let [c (GridBagConstraints.)]
> (set! (.weightx c) 2.0)
> (set! (.gridwidth c) GridBagConstraints/REMAINDER)
> (let [button (JB
I am trying to write a function to simplify working with GridBagConstraints
-- that is, instead of writing
(let [c (GridBagConstraints.)]
(set! (.weightx c) 2.0)
(set! (.gridwidth c) GridBagConstraints/REMAINDER)
(let [button (JButton. "Hello, world!")]
(.setConstraints (.getLayo
24 matches
Mail list logo