I want to call the square root of 9 from Math:
I tried the following, but it does not work:
(defun main
(format t "~a~%"
(JAVA:JCALL (JAVA:JMETHOD "java.lang.Math" "sqrt" 9.0))))
(main)
Can someone provide a working “.lisp” file which calls the java sqrt function from 9 and prints the result 3 for the abcl implementation ?
To add more context to this response: Java has this notion of static methods that belong to classes, compared to the regular methods that belong/act on instances. So ABCL’s
jmethod
is to call a method using an instance, whilejstatic
is to call a static method using a class.Math.sqrt
happens to be a static method ofMath
class, so usejstatic
. Once this static/regular distinction is cleared up, ABCL interface becomes quite usable.