Gambit for Android

Here’s a preliminary version of Gambit Scheme for the Android platform, inspired by Marc Feeley’s iOS version.

Gambit Scheme, is a “complete, portable, efficient, and reliable implementation of the Scheme programming language, conforming to the R4RS, R5RS and IEEE Scheme standards, and implementing all optional features. Tail calls and first class continuations conform to the Scheme semantics. The full numeric tower is implemented, including: arbitrary precision integers (bignums), rationals, inexact reals (floating point numbers), and complex numbers.”

Gambit for Android includes the ability to interact with a Gambit Scheme REPL (read-evaluate-print-loop), add and save Scheme scripts, and start and telnet into a REPL server running on the device.


Install: Gambit for Android in the Android Market
Source: gambit_android_src.tar.gz

Notes:

  • requires Android 1.6+
  • the user interface is based closely on the iOS version.
  • rudimentary editing within the REPL view: moving cursor onto lines other than the current prompt line will highlight text, and pressing “Enter” will copy the highlighted text for evaluation or further editing.
  • additional functionality (e.g., ability to share code and results from the REPL view) are available via the standard Android menu button.
  • to add a script, press the “Add Script” button at the top of the “Edit Scripts” page, then scroll to the bottom of the page where you’ll find a new, empty text box to enter/edit/save/run your script.
  • one difference between the Android version and Marc’s iOS version is the inclusion of a tailored onscreen keyboard for the latter. I’ll look into constructing something in Android for the next release.
  • 19 Responses to Gambit for Android

    1. keith says:

      Installation has now been linked directly to the Android Market entry: the version there should work for Android versions 1.6+.

      The installation process will install the app in your device’s “internal memory.” Apparently, Android 2.2+ devices allowed movement of installed applications from “internal memory” to your SD card (choose Menu->Settings->Applications->Manage Applications, select Gambit for Android, then press “Move to SD card”.


      I don’t have access to an actual pre-2.2 Android device, but here’s a version of Gambit for Android that may work ok for Android 1.6+:

      Gambit for Android 1.6+

      I believe a limitation of pre-Android-2.2 OS versions is an inability to install apps to your SD card, so I think you’re stuck installing this 1.6+ version in “internal memory”.

      I’d be grateful for feedback from anyone who can try this on pre-2.2 devices.

    2. Alexander Shendi says:

      Hello Keith,

      I tested the Android 1.6+ version on two devices. 1. A Sharp IS01 with Android 1.6 and 2.) an Archos A101 internet tablet claiming to run Android 2.2.1. I’m happy to report that it works on both.

      The Android 2.2 version did not work for me on the tablet.

      Many thanks for giving us a Gambit REPL on Android. It rocks!

    3. Alexander Shendi says:

      I should add that the Archos tablet hung while installing the 2.2+ version, so I didn’t get a chance to test it.

    4. keith says:

      At what point did it hang in installation?

      If folks are having difficulty installing from the .apks above, I have pushed the 1.6+ alpha version to Android Market. The two versions are almost identical except I don’t think you can easily install the 1.6+ version on the SD card on a non-rooted phone.

      https://market.android.com/details?id=org.keithflower.gambit&feature=search_result

    5. keith says:

      Thanks for taking the time to try it out on multiple devices, Alexander. The two versions should behave identically except for the SD card installation issue, which I need to look into further.

    6. Alexander Shendi says:

      Hello,

      I managed to download the apk, was able to start the installation process, but then the progress-bar froze and the device hung. This may have nothing to do with the package — I believe the device is a bit flaky since the last firmware upgrade.

      Best Regards,

      Alexander

    7. keith says:

      Hmmm…I wonder if my digital signing process is completely correct for these non-Android Market apks. Some people are reporting they are able to install from the apks above, but some devices used are not stock, are rooted and running CyanogenMod, etc.

      I’ll check, Alexander, and may put up another 2.2+ apk here but I think I’ll also go ahead and put the 2.2+ version up on Android Market when I get a moment. That process enforces a nice check of the digital signature and does some other audits.

      Thanks again for your kind testing and feedback.

      (Update: the version in Android Market should work ok on all 1.6+ devices, and you can move the installed app to your SD card on Android 2.2+ devices – see first comment above)

    8. androiduser says:

      Installed on my smartphone Android 2.2 via Market: it works. One issue: Add Script button does nothing, it highlights, but nothing else.
      Compliments for your work.

    9. keith says:

      After pushing the “Add Scripts” button, scroll down to the bottom of the page. You should see an empty edit box where you can enter your new script.

      There’s not otherwise much visual feedback indicating anything happened when you push the button…I should add some code to automatically scroll down and show the new script edit box…or place new scripts at the head of the list.

      Thanks for the kind feedback.

    10. androiduser says:

      Sorry… I didn’t realize it… in fact it works… thank you !

    11. I says:

      Awesome app! Please continue updating it. My feedback so far: Using Android 3.1 Asus Transformer with keyboard
      1. One major bug I encountered, sometimes, the interpreter stops responding to my input. In other words, enter brings the line down and does not accept my code anymore – no matter what I do. I have to remove the app through a task manager and start it over to make it work again. I couldn’t capture what made this happen precisely, sorry. But it happened rather often, after a few minutes of use.
      2. Support tablets! These are ten times as likely to be your audience, since they are more likely to be used for productivity apps such as this. What this means is that you need to work on the interface, and to begin with, allow choosing the font size.
      3. Debug mode would be nice

      Thanks!

    12. keith says:

      Thanks very much for your feedback. I’m on the verge of a release that addresses the stability issue you mention, as well as doing some automated reporting if a crash occurs in native code.

      Let me also see if I can do something about the font situation with this next release too. Marc’s version for iOS has a nice tailored on-screen keyboard as well, which I’ve looked into – on Android it’s a bit of a pain to construct, but it’s on my to-do list.

      Can you say more about what you’d like to see in a “debug mode”?

    13. keith says:

      I got one error report today via the Android automated reporting system indicating a problem in the REPL window resulting from use of a number of backspaces while editing – I’ll take a closer look at this, see if I can recreate, and try to push a fix out in this next release. Thanks to that user for submitting the report.

      I’m also looking into Marc’s new iOS 2.0 version, to see about incorporating his enhancements into the Android version for this release.

    14. admin says:

      Gambit for Android v0.2 is available on the Android Market:

      https://market.android.com/details?id=org.keithflower.gambit

    15. Johannes says:

      Do you have any plans to add access to the android APIs?

    16. keith says:

      Some kind of function dispatch is on my TODO list.

    17. Daniel says:

      Hello, nice work. What did you do to reduce the file size? When I compile gambit static library it gets huge. I tried to strip it down, but it is still almost 4M. I see your apk is kinda small.

    18. paines says:

      Hi

      Sorry for my ignorance. What about graphics (open gles) and input handling ?
      Does things like that work out of the box, or would one have to enhance gambit to support this on Andoird devices ?

      Thanks and best regards

    19. Danilo Piazzalunga says:

      Very good app!

      I miss the ability to create scripts with an external editor and then running them in Gambit, without adding them to the scripts collection managed by “Edit Scripts”.