Hi,
I don't understand why this doesn't work:
(jcall (jmethod "java.lang.Math" "sqrt") 4.0)
The error I get is:
No such method: java.lang.Math.sqrt()
Also, this works:
CL-USER> (jcall (jmethod "java.lang.Float" "intValue") 4.0) 4
but when I try this:
(jcall (jmethod "java.lang.Float" "compare") 4.0 5.0)
I get:
No such method: java.lang.Float.compare()
I'm not sure if this is the correct forum for these questions. If there's a better place to ask them let me know. Thanks,
-Dave
On Fri, Aug 20, 2010 at 11:48 AM, David Dreisigmeyer david.dreisigmeyer@gmail.com wrote:
Hi, I don't understand why this doesn't work: (jcall (jmethod "java.lang.Math" "sqrt") 4.0)
You need to give the sqrt arguments to jmethod -- in this case "double", and a class argument to jcall -- in this case nil
(jcall (jmethod "java.lang.Math" "sqrt" "double") nil 4.0)
For static methods you can also use jstatic:
(jstatic "sqrt" "java.lang.Math" 4.0)
-david k.
The error I get is: No such method: java.lang.Math.sqrt() Also, this works: CL-USER> (jcall (jmethod "java.lang.Float" "intValue") 4.0) 4 but when I try this: (jcall (jmethod "java.lang.Float" "compare") 4.0 5.0) I get: No such method: java.lang.Float.compare() I'm not sure if this is the correct forum for these questions. If there's a better place to ask them let me know. Thanks, -Dave _______________________________________________ armedbear-devel mailing list armedbear-devel@common-lisp.net http://common-lisp.net/cgi-bin/mailman/listinfo/armedbear-devel
On Fri, Aug 20, 2010 at 12:13 PM, David Kirkman dkirkman@ucsd.edu wrote:
On Fri, Aug 20, 2010 at 11:48 AM, David Dreisigmeyer david.dreisigmeyer@gmail.com wrote:
Hi,
I missed the bottom of your message!
Also, this works: CL-USER> (jcall (jmethod "java.lang.Float" "intValue") 4.0) 4
This works for you because 4.0 is the class argument to jcall, and it ends up being passed as a java.lang.Float.
You'll get an error if you try it with 4.0d0, or if you have your *read-default-float-format* set to double.
but when I try this: (jcall (jmethod "java.lang.Float" "compare") 4.0 5.0) I get: No such method: java.lang.Float.compare()
(jcall (jmethod "java.lang.Float" "compare" "float" "float") nil 4.0s0 5.0s0)
or
(jcall (jmethod "java.lang.Float" "compareTo" "java.lang.Float") 4.0s0 5.0s0)
Thanks David.
On Fri, Aug 20, 2010 at 3:26 PM, David Kirkman dkirkman@ucsd.edu wrote:
On Fri, Aug 20, 2010 at 12:13 PM, David Kirkman dkirkman@ucsd.edu wrote:
On Fri, Aug 20, 2010 at 11:48 AM, David Dreisigmeyer david.dreisigmeyer@gmail.com wrote:
Hi,
I missed the bottom of your message!
Also, this works: CL-USER> (jcall (jmethod "java.lang.Float" "intValue") 4.0) 4
This works for you because 4.0 is the class argument to jcall, and it ends up being passed as a java.lang.Float.
You'll get an error if you try it with 4.0d0, or if you have your *read-default-float-format* set to double.
but when I try this: (jcall (jmethod "java.lang.Float" "compare") 4.0 5.0) I get: No such method: java.lang.Float.compare()
(jcall (jmethod "java.lang.Float" "compare" "float" "float") nil 4.0s0 5.0s0)
or
(jcall (jmethod "java.lang.Float" "compareTo" "java.lang.Float") 4.0s0 5.0s0)
On Fri, Aug 20, 2010 at 3:26 PM, David Kirkman dkirkman@ucsd.edu wrote:
On Fri, Aug 20, 2010 at 12:13 PM, David Kirkman dkirkman@ucsd.edu wrote:
On Fri, Aug 20, 2010 at 11:48 AM, David Dreisigmeyer david.dreisigmeyer@gmail.com wrote:
Hi,
I missed the bottom of your message!
Also, this works: CL-USER> (jcall (jmethod "java.lang.Float" "intValue") 4.0) 4
This works for you because 4.0 is the class argument to jcall, and it ends up being passed as a java.lang.Float.
** Should the above been called as:
CL-USER> (jcall (jmethod "java.lang.Float" "intValue") 4.0s0)
instead, and then (jcall (jmethod "java.lang.Double" "intValue") 4.0d0).
You'll get an error if you try it with 4.0d0, or if you have your *read-default-float-format* set to double.
but when I try this: (jcall (jmethod "java.lang.Float" "compare") 4.0 5.0) I get: No such method: java.lang.Float.compare()
(jcall (jmethod "java.lang.Float" "compare" "float" "float") nil 4.0s0 5.0s0)
or
(jcall (jmethod "java.lang.Float" "compareTo" "java.lang.Float") 4.0s0 5.0s0)
armedbear-devel@common-lisp.net