Hacker Newsnew | past | comments | ask | show | jobs | submitlogin

I managed to miss it! FAIL.

Based on what you wrote, Chicken is out - I want reentrant.

...

I got Gambit to compile, simple expressions appear to work - but I cannot figure out how to compile them to a binary executable.

  cat t.scheme
  (define Hello "Hello")
  gsc t.scheme
  file t.o1 
  t.o1: ELF 32-bit LSB dynamic lib 80386 Version 1, dynamically linked, not stripped, no debugging information available
  ./t.o1
  Segmentation fault (core dumped)
...so that needs more research. I also haven't tested on sparc.


First off, the standard extension for scheme files is .scm

Not really relevant, but I thought you'd want to know.

Since Chicken's non-reentrance only matters if you're passing callbacks into C code, I'll assume you're doing that. It should be noted that Chicken can sort-of have callbacks, so it may be acceptable for your use-case. Either way, be careful to return from C calls in the same order you entered them: not doing so will crash your program. It might seem hard not to do this, but call/cc makes it very easy, and having another thread return into C causes the same problem, since scheme execution threads are pre-emptive coroutines, and are thus one thread from C's perspective.

The problem with the code above is that by default, Gambit generates a shared library for use in other compiled scheme code or a repl. To get an executable, you must specify -exe:

  gsc -exe t.scm
Note also that Gambit's configure script option page (http://gambitscheme.org/wiki/index.php/Configure_script_opti...) provides some handy options to feed to the configure script to speed up the interpreter, notes the reccomended use of GCC (although GCC is not necessary!), and also specifies how to use Sun's compiler to generate 64-bit code on SPARC architectures, if you want to do that. If you're using GCC, this shouldn't matter.

Also, I'd reccomend reading both gambit's manual and the R5RS standard. Knowing the standard and your implementation's deviations and extensions to it is important. Be sure to read the wiki as well, as gambit's manual is not as complete as the wiki.

schemers.org and the scheme wiki have a lot of aids for learning scheme, especially some of the stranger parts, like call/cc.

The Scheme Programming Language Third edition (not the 4th edition, which covers the much-maligned R6RS), and The Little/Seasoned/Reasoned Schemer series can help you think like a Schemer. Scheme is thoroughly multi-paradigm, so this is important.

Finally, there's a lot of gambit libraries all around. The Black Hole and SchemeSpheres module systems contain most of them, although some of SchemeSpheres is linux-specific. You may also take advantage of SLIB, one of the few portable scheme libraries, which contains a wide variety of handy utilities, and SXML, for processing and outputting HTML/XML without the hell.

Whatever you do, you'll probably have to write a lot of FFI code, because the library you want probably isn't wrapped. It's a little better in other schemes, mostly Chicken, but not really that much. It's just the price you pay for using a less popular language.




Consider applying for YC's Winter 2027 batch! Applications are open till November 2.

Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: