<div dir="ltr"><div><div>Greetings, currently I am building extension for AI, as indicated in title. It works for Scheme (JScheme and Kawa). It is quite a simply one, for now, I am only interested in evaluating simple symbolic expression, and then build on that, adding other features etc.<br><br></div>However, I would also like to have access to Common Lisp, ergo ABCL.<br><br></div>Here is a code for its respective method:<br><br>  @SimpleFunction(description = "ABCL evaluation")<br>  public String ABCLEvaluation(String expression) {<br>    <br>    // Environment.getInstance(true);<br>    // Interpreter abclInterpreter = Interpreter.createInstance();<br>    // Interpreter.createInstance(); <br>    // LispObject evalResult = Interpreter.evaluate(expression);<br><br>    Interpreter interpreter = Interpreter.createInstance();<br>    LispObject lo=  interpreter.eval(expression);<br>    <br>    return lo.getStringValue();<br>  }<br><br clear="all"><div><div><div>Commented code is there for completion sake, just as an indication that I tried everything I could find in documentation and examples. Nothing works.</div><div><br></div><div>As you see, idea is a simple one, String is received, and then evaluated, except that in the case of ABCL it isn't. For JScheme and Kawa logic is precisely the same, environment/interpreter is initialized, expression is evaluated and then it returns the correct result.</div><div><br></div><div>After playing with the various code combinations, there are always just two errors present in logs, so here they are:</div><div><br></div><div>First one:<br></div><div>W/System.err(20761): java.lang.NullPointerException: Attempt to invoke virtual method 'org.armedbear.lisp.LispObject org.armedbear.lisp.Interpreter.eval(java.lang.String)' on a null object reference
<br>W/System.err(20761):     at lisp.tomislavt.ext.LispEvaluation.ABCLEvaluation(LispEvaluation.java:46)
<br>W/System.err(20761):     at java.lang.reflect.Method.invoke(Native Method)
<br>W/System.err(20761):     at java.lang.reflect.Method.invoke(Method.java:372)
<br>W/System.err(20761):     at gnu.expr.PrimProcedure.apply(PrimProcedure.java:285)
<br>W/System.err(20761):     at gnu.mapping.CallContext.runUntilDone(CallContext.java:234)
<br>W/System.err(20761):     at gnu.mapping.CallContext.runUntilValue(CallContext.java:298)
<br>W/System.err(20761):     at gnu.mapping.MethodProc.applyN(MethodProc.java:113)
<br>W/System.err(20761):     at gnu.kawa.reflect.Invoke.applyN(Invoke.java:193)
<br>W/System.err(20761):     at gnu.kawa.functions.ApplyToArgs.applyN(ApplyToArgs.java:139)
<br>W/System.err(20761):     at gnu.kawa.functions.Apply.applyN(Apply.java:70)
<br>W/System.err(20761):     at gnu.mapping.ProcedureN.apply2(ProcedureN.java:39)
<br>W/System.err(20761):     at com.google.youngandroid.runtime.callComponentMethod(runtime1661793284635134238.scm:879)
<br>W/System.err(20761):     at appinventor.ai_test.AbclKawaTest.Screen1.Abcl$Click(Screen1.yail:68)
<br>W/System.err(20761):     at appinventor.ai_test.AbclKawaTest.Screen1$frame.apply0(Screen1.yail:456)
<br>W/System.err(20761):     at gnu.expr.ModuleBody.applyN(ModuleBody.java:226)
<br>W/System.err(20761):     at gnu.expr.ModuleMethod.applyN(ModuleMethod.java:216)
<br>W/System.err(20761):     at gnu.kawa.functions.ApplyToArgs.applyN(ApplyToArgs.java:139)
<br>W/System.err(20761):     at gnu.kawa.functions.Apply.applyN(Apply.java:70)
<br>W/System.err(20761):     at gnu.mapping.ProcedureN.apply2(ProcedureN.java:39)
<br>W/System.err(20761):     at appinventor.ai_test.AbclKawaTest.Screen1.dispatchEvent(Screen1.yail:10121)
<br>W/System.err(20761):     at com.google.appinventor.components.runtime.EventDispatcher.delegateDispatchEvent(EventDispatcher.java:220)
<br>W/System.err(20761):     at com.google.appinventor.components.runtime.EventDispatcher.dispatchEvent(EventDispatcher.java:198)
<br>W/System.err(20761):     at com.google.appinventor.components.runtime.Button.Click(Button.java:51)
<br>W/System.err(20761):     at com.google.appinventor.components.runtime.Button.click(Button.java:43)
<br>W/System.err(20761):     at com.google.appinventor.components.runtime.ButtonBase.onClick(ButtonBase.java:656)
<br>W/System.err(20761):     at android.view.View.performClick(View.java:4848)
<br>W/System.err(20761):     at android.view.View$PerformClick.run(View.java:20262)
<br>W/System.err(20761):     at android.os.Handler.handleCallback(Handler.java:815)
<br>W/System.err(20761):     at android.os.Handler.dispatchMessage(Handler.java:104)
<br>W/System.err(20761):     at android.os.Looper.loop(Looper.java:194)
<br>W/System.err(20761):     at android.app.ActivityThread.main(ActivityThread.java:5631)
<br>W/System.err(20761):     at java.lang.reflect.Method.invoke(Native Method)
<br>W/System.err(20761):     at java.lang.reflect.Method.invoke(Method.java:372)
<br>W/System.err(20761):     at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:959)
<br>W/System.err(20761):     at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:754)
<br>I/RuntimeErrorAlert(20761): in alert</div><div><br></div><div>Second one:</div><div><br></div><div>W/System.err(26401): Unable to determine LISP_HOME.
<br>W/System.err(26401): Unable to determine LISP_HOME.
<br>W/System.err(26401): org.armedbear.lisp.IntegrityError
<br>W/System.err(26401):     at org.armedbear.lisp.Primitives$pf_error.execute(Primitives.java:1577)
<br>W/System.err(26401):     at org.armedbear.lisp.Primitive.execute(Primitive.java:113)
<br>W/System.err(26401):     at org.armedbear.lisp.Symbol.execute(Symbol.java:803)
<br>W/System.err(26401):     at org.armedbear.lisp.Lisp.error(Lisp.java:383)
<br>W/System.err(26401):     at org.armedbear.lisp.Load.loadSystemFile(Load.java:322)
<br>W/System.err(26401):     at org.armedbear.lisp.Interpreter.initializeLisp(Interpreter.java:172)
<br>W/System.err(26401):     at org.armedbear.lisp.Interpreter.createInstance(Interpreter.java:72)
<br>W/System.err(26401):     at lisp.tomislavt.ext.LispEvaluation.ABCLEvaluation(LispEvaluation.java:48)
<br>W/System.err(26401):     at java.lang.reflect.Method.invoke(Native Method)
<br>W/System.err(26401):     at java.lang.reflect.Method.invoke(Method.java:372)
<br>W/System.err(26401):     at gnu.expr.PrimProcedure.apply(PrimProcedure.java:285)
<br>W/System.err(26401):     at gnu.mapping.CallContext.runUntilDone(CallContext.java:234)
<br>W/System.err(26401):     at gnu.mapping.CallContext.runUntilValue(CallContext.java:298)
<br>W/System.err(26401):     at gnu.mapping.MethodProc.applyN(MethodProc.java:113)
<br>W/System.err(26401):     at gnu.kawa.reflect.Invoke.applyN(Invoke.java:193)
<br>W/System.err(26401):     at gnu.kawa.functions.ApplyToArgs.applyN(ApplyToArgs.java:139)
<br>W/System.err(26401):     at gnu.kawa.functions.Apply.applyN(Apply.java:70)
<br>W/System.err(26401):     at gnu.mapping.ProcedureN.apply2(ProcedureN.java:39)
<br>W/System.err(26401):     at com.google.youngandroid.runtime.callComponentMethod(runtime284371300273757224.scm:879)
<br>W/System.err(26401):     at appinventor.ai_test.AbclKawaTest3.Screen1.Abcl$Click(Screen1.yail:68)
<br>W/System.err(26401):     at appinventor.ai_test.AbclKawaTest3.Screen1$frame.apply0(Screen1.yail:456)
<br>W/System.err(26401):     at gnu.expr.ModuleBody.applyN(ModuleBody.java:226)
<br>W/System.err(26401):     at gnu.expr.ModuleMethod.applyN(ModuleMethod.java:216)
<br>W/System.err(26401):     at gnu.kawa.functions.ApplyToArgs.applyN(ApplyToArgs.java:139)
<br>W/System.err(26401):     at gnu.kawa.functions.Apply.applyN(Apply.java:70)
<br>W/System.err(26401):     at gnu.mapping.ProcedureN.apply2(ProcedureN.java:39)
<br>W/System.err(26401):     at appinventor.ai_test.AbclKawaTest3.Screen1.dispatchEvent(Screen1.yail:10121)
<br>W/System.err(26401):     at com.google.appinventor.components.runtime.EventDispatcher.delegateDispatchEvent(EventDispatcher.java:220)
<br>W/System.err(26401):     at com.google.appinventor.components.runtime.EventDispatcher.dispatchEvent(EventDispatcher.java:198)
<br>W/System.err(26401):     at com.google.appinventor.components.runtime.Button.Click(Button.java:51)
<br>W/System.err(26401):     at com.google.appinventor.components.runtime.Button.click(Button.java:43)
<br>W/System.err(26401):     at com.google.appinventor.components.runtime.ButtonBase.onClick(ButtonBase.java:656)
<br>W/System.err(26401):     at android.view.View.performClick(View.java:4848)
<br>W/System.err(26401):     at android.view.View$PerformClick.run(View.java:20262)
<br>W/System.err(26401):     at android.os.Handler.handleCallback(Handler.java:815)
<br>W/System.err(26401):     at android.os.Handler.dispatchMessage(Handler.java:104)
<br>W/System.err(26401):     at android.os.Looper.loop(Looper.java:194)
<br>W/System.err(26401):     at android.app.ActivityThread.main(ActivityThread.java:5631)
<br>W/System.err(26401):     at java.lang.reflect.Method.invoke(Native Method)
<br>W/System.err(26401):     at java.lang.reflect.Method.invoke(Method.java:372)
<br>W/System.err(26401):     at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:959)
<br>W/System.err(26401):     at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:754)
<br>I/System.out(26401): ERROR placeholder called with arguments:
<br>I/System.out(26401): Failed to find loadable system file 'boot.lisp' in boot classpath.
<br>I/System.out(26401): Failed to find loadable system file 'boot.lisp' in boot classpath.
<br>W/System.err(26401): org.armedbear.lisp.IntegrityError
<br>W/System.err(26401):     at org.armedbear.lisp.Primitives$pf_error.execute(Primitives.java:1577)
<br>W/System.err(26401):     at org.armedbear.lisp.Primitive.execute(Primitive.java:113)
<br>W/System.err(26401):     at org.armedbear.lisp.Symbol.execute(Symbol.java:803)
<br>W/System.err(26401):     at org.armedbear.lisp.Lisp.error(Lisp.java:383)
<br>W/System.err(26401):     at org.armedbear.lisp.Load.loadSystemFile(Load.java:322)
<br>W/System.err(26401):     at org.armedbear.lisp.Interpreter.initializeLisp(Interpreter.java:172)
<br>W/System.err(26401):     at org.armedbear.lisp.Interpreter.createInstance(Interpreter.java:72)
<br>W/System.err(26401):     at lisp.tomislavt.ext.LispEvaluation.ABCLEvaluation(LispEvaluation.java:48)
<br>W/System.err(26401):     at java.lang.reflect.Method.invoke(Native Method)
<br>W/System.err(26401):     at java.lang.reflect.Method.invoke(Method.java:372)
<br>W/System.err(26401):     at gnu.expr.PrimProcedure.apply(PrimProcedure.java:285)
<br>W/System.err(26401):     at gnu.mapping.CallContext.runUntilDone(CallContext.java:234)
<br>W/System.err(26401):     at gnu.mapping.CallContext.runUntilValue(CallContext.java:298)
<br>W/System.err(26401):     at gnu.mapping.MethodProc.applyN(MethodProc.java:113)
<br>W/System.err(26401):     at gnu.kawa.reflect.Invoke.applyN(Invoke.java:193)
<br>W/System.err(26401):     at gnu.kawa.functions.ApplyToArgs.applyN(ApplyToArgs.java:139)
<br>W/System.err(26401):     at gnu.kawa.functions.Apply.applyN(Apply.java:70)
<br>W/System.err(26401):     at gnu.mapping.ProcedureN.apply2(ProcedureN.java:39)
<br>W/System.err(26401):     at com.google.youngandroid.runtime.callComponentMethod(runtime284371300273757224.scm:879)
<br>W/System.err(26401):     at appinventor.ai_test.AbclKawaTest3.Screen1.Abcl$Click(Screen1.yail:68)
<br>W/System.err(26401):     at appinventor.ai_test.AbclKawaTest3.Screen1$frame.apply0(Screen1.yail:456)
<br>W/System.err(26401):     at gnu.expr.ModuleBody.applyN(ModuleBody.java:226)
<br>W/System.err(26401):     at gnu.expr.ModuleMethod.applyN(ModuleMethod.java:216)
<br>W/System.err(26401):     at gnu.kawa.functions.ApplyToArgs.applyN(ApplyToArgs.java:139)
<br>W/System.err(26401):     at gnu.kawa.functions.Apply.applyN(Apply.java:70)
<br>W/System.err(26401):     at gnu.mapping.ProcedureN.apply2(ProcedureN.java:39)
<br>W/System.err(26401):     at appinventor.ai_test.AbclKawaTest3.Screen1.dispatchEvent(Screen1.yail:10121)
<br>W/System.err(26401):     at com.google.appinventor.components.runtime.EventDispatcher.delegateDispatchEvent(EventDispatcher.java:220)
<br>W/System.err(26401):     at com.google.appinventor.components.runtime.EventDispatcher.dispatchEvent(EventDispatcher.java:198)
<br>W/System.err(26401):     at com.google.appinventor.components.runtime.Button.Click(Button.java:51)
<br>W/System.err(26401):     at com.google.appinventor.components.runtime.Button.click(Button.java:43)
<br>W/System.err(26401):     at com.google.appinventor.components.runtime.ButtonBase.onClick(ButtonBase.java:656)
<br>W/System.err(26401):     at android.view.View.performClick(View.java:4848)
<br>W/System.err(26401):     at android.view.View$PerformClick.run(View.java:20262)
<br>W/System.err(26401):     at android.os.Handler.handleCallback(Handler.java:815)
<br>W/System.err(26401):     at android.os.Handler.dispatchMessage(Handler.java:104)
<br>W/System.err(26401):     at android.os.Looper.loop(Looper.java:194)
<br>W/System.err(26401):     at android.app.ActivityThread.main(ActivityThread.java:5631)
<br>W/System.err(26401):     at java.lang.reflect.Method.invoke(Native Method)
<br>W/System.err(26401):     at java.lang.reflect.Method.invoke(Method.java:372)
<br>W/System.err(26401):     at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:959)
<br>W/System.err(26401):     at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:754)</div><div><br></div><div>I hope that I am missing something obvious :), and I am thankful in advance for any input, advice or idea.</div><div><br></div><div>Some additional clarification may be in order, MIT App Inventor is environment for rapid development of applications for Android (Arduino, Lego mindstorm etc.), hence it doesn't follow usual Android work-flow. Backbone of it is Kawa, components, extensions are written in Java, but more about it can be easily find on its webpage.<br></div><div><br></div><div>First log example is fairly useless one imo, when i tested my extension with simple App, same expression was evaluated correctly in both Kawa and JScheme, so that String was not a null one, but I've put it here for completion sake. <br></div><div><br></div><div>For the second one I've find something similar for version a.1 or 1.2, back in 2012, I believe, and it was something about dynamic linking during the build process.</div><div>I am using ABCL 1.5 jar that I downloaded from the ABCL project page.</div><div><br></div><div>In any case, I am bit at loss, and thus, I would appreciate any advice what should I try next. Thank you for your time.</div><div><br></div><div>Respectfully, <br></div><div><div class="gmail_signature">Tomislav Tomsic</div>
</div></div></div></div>