mocl

(+ lisp ios android)

Lisp for iOS and Android.

Creating mobile applications shouldn't require you to do everything in Java and Objective-C. With mocl, you can put your application logic into a shared Lisp library that runs on both iOS and Android. Furthermore, since mocl runs an expansive subset of Common Lisp, an ANSI standard like C, you can re-use your CL code across many other Common Lisp implementations. Run your code everywhere — and at native speed.

Fast Native Code via LLVM, with a Small Footprint.

Mobile devices are slower and more resource-constrained than their desktop peers. Accordingly, mocl is a highly optimizing Lisp implementation, delivering tight native code via LLVM/Clang. In fact, mocl is so fast that on some benchmarks, it blows away Google's own Dalvik JVM.

* Code at mocl-benchmark-android. Parameters: n=16 on Nexus 4 w/ Android 4.2.2
Dalvik vs. mocl,
binary-trees*

Networking, Unicode, CLOS, and More. Run Countless CL Libraries.

Too many developer tools sound promising, only to fall flat when you attempt to do anything non-trivial. “That free thing seemed great, until we found ourselves spending more time on it than our actual project.” mocl aims for a different approach: it “just works” from the start. Unicode is supported automatically, by default. mocl has networking, CLOS, gray streams, and more. You can already run countless popular CL libraries with mocl. And more are on the way.

Debuggable.

With debugging enabled, mocl provides you stack traces that zero in on the source of errors when they occur. Plus, since mocl generates C/Obj-C code, profiling tools like Apple's Instruments work great, helping you measure and diagnose performance issues, quickly.

Drops Seamlessly into New or Existing Projects.

Adding mocl to your project is as simple as adding a library. Whether your project is new or existing, this takes just a minute. Xcode and Android Developer Tools are fully supported.

How it Works

mocl is built around the idea that your application logic should live in Lisp, and your user interface code should be fully native to the platform — Obj-C or Java in the case of iOS and Android. This is not unlike the web, where your server logic is in one language (hopefully Lisp), and the client logic is in HTML/JavaScript. For example:

We set up (using Apple's Xcode) an Objective-C event handler called onDoneTap that triggers when the 'Done' button is tapped.

- (IBAction)onDoneTap:(id)sender {
    [[self view] endEditing:YES];
    update_contact([_txtName text], [_txtMobile text], [_txtEmail text]);
    save_contacts();
    ...

When the event is triggered, our Lisp code gets called.

(declaim (call-in update-contact))
(defun update-contact (name mobile email)
  (setf (contact-name *current-contact*) name
        (contact-mobile *current-contact*) mobile
        (contact-email *current-contact*) email))

(declaim (call-in save-contacts))
(defun save-contacts ()
  (when (and *current-contact* (not (member *current-contact* *contacts*)))
    (push *current-contact* *contacts*)
    (setf *contacts* (sort *contacts* #'string< :key #'contact-name)))
  (let ((file (merge-pathnames *doc-dir* "contacts.lisp")))
    (string-to-file (prin1-to-string *contacts*) file)))

Take notice that all you need to make your lisp code callable is to declaim it with very little boilerplate. Within the call-in declaration for update-contact, even though it takes three arguments, we did not need to specify the argument names or their types. This was handled automatically by mocl.

We can do the tap event on the Android side as well, calling the same Lisp code from Java:

public void onDoneTap(MenuItem m) {
    CL.update_contact(txtName.getText(), txtMobile.getText(), txtEmail.getText());
    CL.save_contacts();
    ...

Check out the full source code for these examples at the Wukix GitHub: both the iOS Example and the Android Example.

Download in (<= 60) seconds.

Enterprise License
mocl with source code and priority support
Source Code License
mocl with source code
Standard License
Just mocl
Group Licenses
License your team, research group, etc.
(Javascript Required)

Each license includes, free, one year of updates and upgrades following the purchase date, including major version upgrades.

If you are unsatisfied with mocl in any way, let us know within 30 days of your purchase that you wish to terminate your license, and we'll refund you.

Powering Mobile Lisp Worldwide

Receive Announcements

 

© 2013 Wukix, Inc.