[gambit-list] Efficient Compilation of Tail Calls and Continuations to JavaScript

Steve Graham jsgrahamus at yahoo.com
Tue Sep 17 11:09:56 EDT 2013


Marc,

   Thanks for the example.

   When I ran it, I got the following:
steve at steve-Satellite-L555D ~ $ js fib.js
js: uncaught JavaScript runtime exception: TypeError: Cannot find function real-time-milliseconds in object [object Object].

I'm running Gambit 4.6.7 on a 64-bit Linux Mint 14.


Steve



________________________________
 From: Marc Feeley <feeley at iro.umontreal.ca>
To: Mikael <mikael.rcv at gmail.com> 
Cc: gambit-list at iro.umontreal.ca 
Sent: Monday, September 16, 2013 9:29 PM
Subject: Re: [gambit-list] Efficient Compilation of Tail Calls and	Continuations to JavaScript
 


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

_______________________________________________
Gambit-list mailing list
Gambit-list at iro.umontreal.ca
https://webmail.iro.umontreal.ca/mailman/listinfo/gambit-list
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mailman.iro.umontreal.ca/pipermail/gambit-list/attachments/20130917/779ae18a/attachment.htm>


More information about the Gambit-list mailing list