[gambit-list] Using the JavaScript back-end
Blake McBride
blake at mcbride.name
Sat Jan 31 12:38:26 EST 2015
Dear Mark,
Thanks for your pointers regarding scheme back-ends for JavaScript. I
starting using Gambit but ran into a few problems as follows:
1. The -target compiler option is undocumented. I think Gambit is more
capabilities than the public is aware of - i.e. JavaScript back-end.
2. When I compile anything into JS and run it in node I get:
pc = pc();
^
TypeError: undefined is not a function
If I change the definition of gambit_trampoline to:
function gambit_trampoline(pc) {
while (pc !== false && pc !== undefined) {
pc = pc();
}
}
it fixes the problem.
3. I'd like to print results to the console so I can see what is going
on. I'd prefer to use (print) or (display) but I can't get (console.log)
to work either.
I even tried:
(define (console.log x)
;; Note: the parameter x will be in variable Gambit_r1
(##inline-host-code "console.log(Gambit_r1);\n")
#f)
but that didn't work either.
I checked, console.log seems to be a JS standard. Perhaps your compiler
can convert print and display to console.log.
How can I display something?
Thanks.
Blake McBride
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mailman.iro.umontreal.ca/pipermail/gambit-list/attachments/20150131/36e5f49e/attachment.htm>
More information about the Gambit-list
mailing list