[gambit-list] Using Gambit Scheme with Xcode

Marc Feeley feeley at iro.umontreal.ca
Mon Apr 4 16:18:42 EDT 2011


On 2011-04-03, at 7:47 PM, John Velman wrote:

> I've tinkered with learning scheme off and on for years, but never had
> enough incentive to stick to it.  Now, with Pixie Scheme III, a real
> programming language implementation, on the iPad, I'm taking another shot
> at Scheme.
> 
> My main computer is an iMac running OS X 10.6.7;  My Xcode is 3.2.5;  I have
> the iOS development kit, but haven't yet started any apps for iPad/iPhone.
> Right now I'm working on a couple of OS X cocoa apps (in addition to
> coming up to speed on Scheme).
> 
> I'd like to be able to do two things with Scheme, hopefully without a lot of
> difficulty:
> 
> 1) Develop OS X applications in Xcode, using C libraries written in Scheme
> for the Model part of MVC, and Cocoa doing the, with Cocoa doing the
> View-Controller stuff.
> 
> Are there any good examples or tutorials available for generating, with
> Gambit Scheme, C-Library routines that can be copied into an Xcode project
> and then used with minimum modification to the Xcode project?

You should look at examples/iOS in the Gambit source code.  It is an example, with Xcode-project for implementing the "Gambit REPL" app for iPhone/iPad.  The "main" function and the GUI stuff are written in Objective-C.  The REPL and event handling are done in Scheme.

The basic idea is that you first need to compile the Gambit runtime library (to give lib/libgambc.a) with a normal "make" of Gambit.  Then you write your Xcode project in Objective-C, and you add the library lib/libgambc.a to the project.  Finally, make sure you initialize the Gambit runtime with a call to ___setup.

> 2) I have an application I'm developing (in Cocoa for OS X) mainly to
> explore some math concepts I'm interested in, for my own use.  Since it is
> by nature exploratory, it seems like a good idea to have an extension
> language.  Scheme seems like a good choice.
> 
> Are there any good examples or tutorials that would get me started using
> Gambit to add an embedded extension language to an Xcode project?

The "Gambit REPL" app would be a good example of this!

Marc




More information about the Gambit-list mailing list