News for hackers. Stuff that matters.
Re:Chicken Scheme by tehwalrus on Friday March 15, 2013 @11:11AM (#5380996)
What's the difference between Chicken and Gambit[1]? I've been reading about/playing with the latter for a few weeks, because of its interop with C (and therefore potential for integration with other C-friendly code, which is why there is an iPhone app that runs the repl.) My interest is that I'd like to write an application core in Scheme, and then write a GUI for iPhone, OS X, Linux and Windows, and I figured Gambit was best for this.

If I should be playing with Chicken instead, tell me why! :)

[1] http://gambitscheme.org/wiki/index.php/Main_Page

Re:Chicken Scheme by csl on Friday March 15, 2013 @11:47AM (#5381177)
One thing is the relatively large number of packages available for Chicken, especially for C libraries on UNIX. Therefore many use Chicken for systems and desktop programming on UNIX.

A list of packages (called "eggs") is available at http://wiki.call-cc.org/chicken-projects/egg-index-4.html

(Disclaimer: I don't know much about Gambit, and cannot comment on their respective implementation capabilities.)

Re:Chicken Scheme by MatthewPhillips on Friday March 15, 2013 @12:57PM (#5381544)
Gambit is extremely fast, that's its main benefit over the competition. It's ecosystem is... very rough, though.
Re:Chicken Scheme by bitwize on Friday March 15, 2013 @03:45PM (#5382564)
Gambit also has (imho) a much easier FFI. (Once you get used to all the ___arg1 and ___result stuff.) So it really is easy to bolt on C -- and even C++ and Objective-C -- code to a Gambit app.
Re:Chicken Scheme by mark_l_watson on Friday March 15, 2013 @02:39PM (#5382206)
True enough. I have used Gambit for several apps in the last 10 years or so, but always for things that don't need a lot of 3rd party libraries. I wrote an article a long time ago on using Gambit for command line utilities and other small apps.
Re:Chicken Scheme by nickmain on Friday March 15, 2013 @04:03PM (#5382672)
From the Chicken documentation [1] it appears that it does not include bignums in the core but as a separate package that requires GMP [2] to be installed. Since GMP is LGPL licensed this might cause an issue if you are sensitive to such things.

Gambit includes bignum support without external dependencies.

[1] http://wiki.call-cc.org/man/4/Deviations%20from%20the%20stan...

[2] http://gmplib.org/

(I use Gambit but not Chicken)

Re:Chicken Scheme by ZaneA on Friday March 15, 2013 @05:21PM (#5383114)
FYI, this hasn't been true for 3 years now: http://lists.nongnu.org/archive/html/chicken-users/2010-03/m...
Re:Chicken Scheme by nickmain on Friday March 15, 2013 @08:01PM (#5383742)
Thanks for the pointer.

This note in the documentation for that egg looks worrisome [1]: "IMPORTANT: This only works when the code will be run on exactly the same platform as the Scheme compiler ran on. Cross-compilation and compiling to C and compiling that on the target platform is not supported. (You will get an error message when you try to do it anyway)"

Does this mean that cross-compiling for iOS would preclude using this bignum egg ?

[1] http://wiki.call-cc.org/eggref/4/numbers#compiled-code

Re:Chicken Scheme by ZaneA on Friday March 15, 2013 @08:32PM (#5383829)
I have no experience with it personally, so that might indeed be the case. If anyone mentions otherwise on IRC (#chicken on freenode) I will update this accordingly.
Re:Chicken Scheme by tehwalrus on Saturday March 16, 2013 @07:02AM (#5385066)
I remember some horrible compilation issues with this library while I was trying to get some academic code running - they used the rationals in GMP.
Re:Chicken Scheme by sea6ear on Friday March 15, 2013 @12:52PM (#5381514)
My sense from looking at this same question before (although not doing anything, so this is just impression not experience) is that Gambit is being used more for embedded uses like what you are describing.

I've been interested in Gambit because it seems to allow fairly direct intermixing of Scheme and C code. I don't recall seeing Chicken being able to mix the two in the same file.

Chicken seems to have more libraries available and might be better for use doing things like Unix scripting or system tasks.

By the way, if you are interested in Gambit, and are on Debian/Ubuntu, I would suggest building Gambit from source rather than using the gambc package in the repo. It looks like that package is very out of date at this point. (It's actually been orphaned in Debian and I've been considering adopting it to bring it up to date.)

Re:Chicken Scheme by outworlder on Friday March 15, 2013 @01:48PM (#5381907)
> I've been interested in Gambit because it seems to allow fairly direct intermixing of Scheme and C code. I don't recall seeing Chicken being able to mix the two in the same file.

Actually, it can. Just use a 'foreign-lambda' to embed your C code as a string, if that's what you want.

In fact, Chicken and Gambit's FFI are so similar that I managed to use an OpenGLES FFI from Gambit on Chicken with just a couple of macros to convert between them.

Re:Chicken Scheme by tehwalrus on Friday March 15, 2013 @01:45PM (#5381879)
Thanks. I thought this was the case, but Chicken claiming that it compiled into portable C files rang a bell! In principal, my app doesn't need much more than a couple of local databases (files with S expressions in..) so I don't think extensive system library support would be much advantage.

I have built Gambit from source on both OS X and my Debian VM - no problems using them, but I haven't done anything remotely advanced yet.