Common LISP on iPhone/iOS

2019-04-05 01:47发布

问题:

Is it possible to call a Common Lisp function in iOS?

If so, is it possible create it in a dynamic library?

回答1:

It depends on what you mean by calling a CL function, but most likely ECL will be your shortest path. Start here, as there is a patch for ECL to better accommodate iOS: http://funcall.posterous.com/tag/iphone

ECL generates C code, so you should be in safe territory with Apple's shifting policies.



回答2:

Have you tried MOCL?

According to the website "mocl is a highly optimizing CL implementation, delivering tight native code via LLVM/Clang".

Maybe you can create a dynamic library, though it is designed for use the other way around.



回答3:

Clozure Common Lisp (CCL) runs in Linux on the ARM, and Gary Byers long ago made an experimental iPhone version, but it would only run on a jail-broken iPhone. The problem is that the CCL compiler writes executable code, but iOS out-of-the-box does not allow a writable page to be made executable, so you can't ever RUN that code.

We've had discussions about putting the code that ships with an iOS app be in a read-only code section, and adding a byte-code compiler, so that code created at run-time can be fairly quickly interpreted, but nobody has offered to fund that project, so it hasn't gotten done.

You might think that we could just interpret code created at run-time, but the current CCL "interpreter" compiles non-trivial code before executing it.

MOCL is probably your best option to write code callable from other apps, but that's only a guess, since I haven't used it.



回答4:

You could use Gambit Scheme or Clozure Common Lisp, both are able to interface with Cocoa, the first because it generates C and the latter because there is a bridge from Clozure to Cocoa. Do a google search about it and you will find a few things.



回答5:

There also exists Mobile Common Lisp1