[gambit-list] Efficient Compilation of Tail Calls and Continuations to JavaScript
Marc Feeley
feeley at iro.umontreal.ca
Mon Sep 16 23:29:24 EDT 2013
On 2013-09-09, at 9:33 AM, Mikael <mikael.rcv at gmail.com> wrote:
> Awesome.
>
> For reference, is the implementation of Gambit2JS available anywhere?
>
Yes. It is in the standard release of Gambit. You need to use the option "-target js" to gsc. For example:
% cat fib.scm
(declare
(standard-bindings)
(extended-bindings)
(not safe)
(fixnum)
(block)
)
(define (fib n)
(define (fib n)
(if (< n 2)
n
(+ (fib (- n 1))
(fib (- n 2)))))
(fib n))
(define start (real-time-milliseconds))
(println (fib 30))
(define end (real-time-milliseconds))
(println (- end start))
% gsc -c -target js fib.scm
% js fib.js
832040
2035
Marc
More information about the Gambit-list
mailing list