Questions tagged [gambit]

Questions about the Gambit-C implementation of the Scheme programming language.

Questions about the Gambit-C implementation of the Scheme programming language.

39 questions
19
votes
3 answers

Is there a Haskell/ML-like compiler to C?

People have written games for the iPhone in Scheme. Because (some) Scheme-compilers compile down to C, it was easy to mix with Objective-C and integrate with XCode. I am aware of patches for Haskell and OCaml compilers to enable ARM/iOS-backends.…
LennyStackOverflow
  • 2,228
  • 1
  • 19
  • 22
6
votes
2 answers

Comparing Common Lisp with Gambit w.r.t their library access and object systems

I'm pretty intrigued by Gambit Scheme, in particular by its wide range of supported platforms, and its ability to put C code right in your Scheme source when needed. That said, it is a Scheme, which has fewer "batteries included" as compared to…
SuperElectric
  • 17,548
  • 10
  • 52
  • 69
5
votes
2 answers

What's the Gambit-C's GC mechanism?

What's the Gambit-C's GC mechanism? I'm curious about this for making interactive app. I want to know whether it can avoid burst GC operation or not.
eonil
  • 83,476
  • 81
  • 317
  • 516
4
votes
1 answer

scheme format function missing from gambit

I attempted to run a gambit scheme script that was previously run with guile. I noticed that gambit fails because it is missing the "format" function. Is format not part of scheme? (format #t "example(~a)=<~a>\n" i (example i)) Instead I modified…
henninb
  • 133
  • 2
  • 11
4
votes
1 answer

How do I return a symbol from a C function in gambit scheme?

I've got a C function behind a c-lambda which needs to do some grubbing around with a select(2) call and decide on a scheme symbol to return as an indication of what it did, and whether an error condition occurred. How one gets hold of a named…
regularfry
  • 3,248
  • 2
  • 21
  • 27
3
votes
1 answer

Add an extra compile step to a custom compiler/language in CMake

This is a bit of follow-up to an earlier question I posted. My basic problem was to build a application with Gambit Scheme. While the solution suggested in the question mentioned above works, it is kinda cumbersome so I decided to try and add Gambit…
koalag
  • 133
  • 1
  • 16
3
votes
2 answers

Compile Scheme using Gambit-C

I am running Ubuntu 18.04 and I installed gambc to execute Scheme scripts. gsi works fine and can interprete any file I provide, and the REPL is also working as expected. Unfortunately, I can't figure out how to use…
Neven V.
  • 424
  • 5
  • 13
3
votes
1 answer

Implementation of Heaps Algorithm in Scheme (permutation generation)

I want to implement Heap's algorithm in Scheme (Gambit). I read his paper and checked out lots of resources but I haven't found many functional language implementations. I would like to at least get the number of possible permutations. The next step…
RonanCodes
  • 1,016
  • 9
  • 14
3
votes
1 answer

Is there a Macro to use "λ" character as "lambda" in R5RS Scheme?

Is there a Macro to use "λ" character as "lambda" in R5RS Scheme? From here In Gambit "scheme-r5rs" I tried: (define-syntax λ (syntax-rules () ((_ . more) (lambda . more)))) But I keep getting Ill-formed expression error.
GlassGhost
  • 16,906
  • 5
  • 32
  • 45
3
votes
2 answers

Portable load/include of define-syntax in R5RS Scheme?

I'm trying to write something that works in both DrRacket/plt-r5rs and Gambit/gsi. The problem I'm having is that (load "foo.scm") in Gambit does not load define-syntax-blocks. Using (include "foo.scm") in Gambit works, but of course results in a…
Erik Vesteraas
  • 4,675
  • 2
  • 24
  • 37
2
votes
3 answers

Nested ellipsis macro doesn't work in Guile and Racket

I'm trying to create a simple nested macro. It works in my Scheme implementation, but fails to run in Guile and Racket. (define-syntax foo (syntax-rules (:c) ((_ x ...) (let-syntax ((bar (syntax-rules ::: (:c) ((_…
jcubic
  • 61,973
  • 54
  • 229
  • 402
2
votes
1 answer

Gambit-C Scheme: cannot load a windows dll

I'm having troubles with dynamically loading a windows shared library with Gambit-C Scheme. (c-declare "#include ") (c-declare "#include ") (define load-library (c-lambda () void " HINSTANCE lib = LoadLibrary…
Alisa D.
  • 134
  • 6
2
votes
2 answers

n arity zip function in scheme (problems with apply and map)

I am having trouble calling map over a list of lists. 01>(define (foldr f accum xs) (if (null? xs) accum (f (car xs) (foldr f accum (cdr xs))))) 02> (map (lambda xs foldr cons '() xs) '(1 2) '(3 4) '(5 6)) ((1 3 5) (2 4 6)) this is what…
beoliver
  • 5,579
  • 5
  • 36
  • 72
1
vote
3 answers

How to show error message from eval in Scheme?

I'm trying to create code that evaluates expression and return error as string for error: (cond-expand (gambit) (gauche) (kawa) (guile (import (rnrs base) (rnrs exceptions) (rnrs conditions)) (define…
jcubic
  • 61,973
  • 54
  • 229
  • 402
1
vote
2 answers

Macro calling macro gives "undefined variable" in Gambit Scheme

In Gambit Scheme, I can't seem to invoke a macro in the definition of another macro if I compile the file. Here is a contrived example: ;;;; example.scm (define-macro (w/gensyms gs body) `(let ,(map (lambda (g) `(,g (gensym ',g))) …
scpayson
  • 192
  • 8
1
2 3