Hi, any idea for quick and convenient acces to kawa.repl?

47 views
Skip to first unread message

Tomislav Tomšić

unread,
Aug 8, 2017, 5:13:29 PM8/8/17
to App Inventor Open Source Development
For nothing much more complicated than ( + 2 2), where kawa would return correct result (4 I presume ;) ), and/or simple example of lambda calculus. Just for me to be able to make a modest educational app to showcase some different paradigms in software development.

I imagine, a block akin to evaluate but ignore result in control drawer, but this one would be "evaluate and return result" (string in all likelihood).

Thanks in advance for any idea/insight.

Hal Abelson

unread,
Aug 8, 2017, 9:49:02 PM8/8/17
to App Inventor Open Source Development
You can kind the current kawa jar by doing a web search.

You can also run the version that app inventor uses, as follows:

Go to the folder 
appinventor-sources/appinventor/lib/kawa

Then run in a terminal
java -jar kawa-1.11-modified.jar

This will give you a prompt, and you can type Kawa expressions at it, teminated with Newline:

$ java -jar kawa-1.11-modified.jar 
#|kawa:1|# (+ 2 3)
5

Tomislav Tomšić

unread,
Aug 9, 2017, 3:54:19 PM8/9/17
to App Inventor Open Source Development
Thank you for your answer Mr Abelson, and I have to say it is an honor to hear from a man of your achievements and results.
I would also like to apologize for imprecision in my question, thus wasting your time; I'm not a native English speaker.

I was fishing, let's say it like that, for a quick hack, or perhaps, a left-over from times when test procedures for App Inventor where being made. Perhaps, something like this pseudo-code: (evaluate-string (symbol)), or maybe uncommenting something in runtime.scm et cetera.

Like I said, I was being imprecise, unclear even.
Currently I have no need for full REPL capabilities, evaluating, shall we say, in-line data primitives is just fine. In case you are wondering, I intend to couple GUI through contextualized Venn's diagrams (I have no knowledge of better Mathematical terminology), and show how one can generate simple logic with a thumb, what are the possibilities of functional paradigm (or thinking in patterns as I like to call it), and get the correct result from a smartphone, thus my imprecise question, for which I apologize again.

I guess, building feeble, one-time extension, around kawa already used in App Inventor, as you suggested, and possibly using TelnetRepl.java code in components.runtime.util as a guidance is the least time-consuming, and I thank you for your advice.

Respectfully
Tomislav Tomsic

Evan Patton

unread,
Aug 9, 2017, 5:00:41 PM8/9/17
to App Inventor Open Source Development
If you wanted a real quick-and-dirty approach, you can hook into the ReplMgr in your browser's JavaScript console and send Scheme/YAIL using Blockly.ReplMgr.putYail:


You can see the answer (10) as the value in the result from processRetVals.

Evan

Mark Friedman

unread,
Aug 9, 2017, 8:24:51 PM8/9/17
to App Inventor Open Source Development
I think Tomislav wants to access a REPL within an app.  I.e., I think he wants an Eval block.

-Mark

--
You received this message because you are subscribed to the Google Groups "App Inventor Open Source Development" group.
To unsubscribe from this group and stop receiving emails from it, send an email to app-inventor-open-so...@googlegroups.com.
To post to this group, send email to app-inventor-o...@googlegroups.com.
Visit this group at https://groups.google.com/group/app-inventor-open-source-dev.
For more options, visit https://groups.google.com/d/optout.

Hal Abelson

unread,
Aug 9, 2017, 9:17:12 PM8/9/17
to App Inventor Open Source Development


Tomisav, is Mark right about  what you want?  I.e., the ability to do this evaluation within an app?

I think you'd need to do this as an extension.   The extension would create a component with  single method that
take a text string and run the repl on it.   Let us know if you need details on how to do that.




== Hal

Hal Abelson
h...@mit.edu
Prof. of Comp. Sci. and Eng.
MIT Dept. of Elec. Eng. and Comp. Sci.


On Wed, Aug 9, 2017 at 8:24 PM, Mark Friedman <mark.f...@gmail.com> wrote:
I think Tomislav wants to access a REPL within an app.  I.e., I think he wants an Eval block.

-Mark

On Wed, Aug 9, 2017 at 2:00 PM Evan Patton <ewpa...@gmail.com> wrote:
If you wanted a real quick-and-dirty approach, you can hook into the ReplMgr in your browser's JavaScript console and send Scheme/YAIL using Blockly.ReplMgr.putYail:


You can see the answer (10) as the value in the result from processRetVals.

Evan

On Wednesday, August 9, 2017 at 3:54:19 PM UTC-4, Tomislav Tomšić wrote:
Thank you for your answer Mr Abelson, and I have to say it is an honor to hear from a man of your achievements and results.
I would also like to apologize for imprecision in my question, thus wasting your time; I'm not a native English speaker.

I was fishing, let's say it like that, for a quick hack, or perhaps, a left-over from times when test procedures for App Inventor where being made. Perhaps, something like this pseudo-code: (evaluate-string (symbol)), or maybe uncommenting something in runtime.scm et cetera.

Like I said, I was being imprecise, unclear even.
Currently I have no need for full REPL capabilities, evaluating, shall we say, in-line data primitives is just fine. In case you are wondering, I intend to couple GUI through contextualized Venn's diagrams (I have no knowledge of better Mathematical terminology), and show how one can generate simple logic with a thumb, what are the possibilities of functional paradigm (or thinking in patterns as I like to call it), and get the correct result from a smartphone, thus my imprecise question, for which I apologize again.

I guess, building feeble, one-time extension, around kawa already used in App Inventor, as you suggested, and possibly using TelnetRepl.java code in components.runtime.util as a guidance is the least time-consuming, and I thank you for your advice.

Respectfully
Tomislav Tomsic

--
You received this message because you are subscribed to the Google Groups "App Inventor Open Source Development" group.
To unsubscribe from this group and stop receiving emails from it, send an email to app-inventor-open-source-dev+unsub...@googlegroups.com.
To post to this group, send email to app-inventor-open-source-dev@googlegroups.com.

--
You received this message because you are subscribed to a topic in the Google Groups "App Inventor Open Source Development" group.
To unsubscribe from this topic, visit https://groups.google.com/d/topic/app-inventor-open-source-dev/MCbbE9uMlkI/unsubscribe.
To unsubscribe from this group and all its topics, send an email to app-inventor-open-source-dev+unsub...@googlegroups.com.
To post to this group, send email to app-inventor-open-source-dev@googlegroups.com.

Tomislav Tomšić

unread,
Aug 11, 2017, 3:46:12 PM8/11/17
to App Inventor Open Source Development
Indeed, I was interested in eval block, and again I apologize for my insufficient linguistic skills.
Anyway, I think I solved it, thus past tense.
Extension is, it seems, the most sensible approach. Solution presented in Kawa's documentation seem straightforward enough:
https://www.gnu.org/software/kawa/Evaluating-Scheme-expressions-from-Java.html

And I already tried them, and they didn't work.... And then I realized that I am reading documentation for kawa 2.4 while insisting on Kawa 1.1 in my code ;).
Now I am in the process of importing 2.4 as external library, I do not expect any (problems) but one can never know.
In any case, I'll post news here. I hope I'll finish it over the weekend, my sister and her kids came to visit yesterday, still I hope I'll manage to finish eval extension in the indicated time-frame.

Thanks for all the help :)

Mark Friedman

unread,
Aug 11, 2017, 4:28:29 PM8/11/17
to App Inventor Open Source Development
I would guess that there will be an issue with trying to include two different version of Kawa in one app, due to them being in the same Java package.  Assuming that's true, you might want to use a different Java-based Scheme interpreter for your extension, such as JScheme or SISC.

-Mark

--
You received this message because you are subscribed to the Google Groups "App Inventor Open Source Development" group.
To unsubscribe from this group and stop receiving emails from it, send an email to app-inventor-open-so...@googlegroups.com.
To post to this group, send email to app-inventor-o...@googlegroups.com.
Reply all
Reply to author
Forward
Message has been deleted
0 new messages