Re: Python and Scheme
- From: namekuseijin <namekuseijin@xxxxxxxxx>
- Date: Thu, 23 Apr 2009 11:54:42 -0700 (PDT)
namekuseijin escreveu:
namekuseijin escreveu:
Michele Simionato escreveu:
On Apr 23, 6:19 pm, Sam TH <sam...@xxxxxxxxx> wrote:
[samth@punge:~/work/teaching/current] cat tailcall.ssBut the best is Larceny:
(import (rnrs))
(let loop ([n 1000]) (if (zero? n) #f (begin (/ 1 (- n 12)) (loop (- n
1)))))
$/home/micheles/packages/larceny_src/scheme-script tailcall2.ss
no error here (!!???)
This issues an error:
(let loop ((n 1000) (r #f)) (if (zero? n) r (loop (- n
1) (/ 1 (- n 12)))))
I guess the error is just ignored being in the head of begin since it
affects no further computation...
Perhaps it even simply removes the useless computation when compiling
down to native code?...
Damn, should test first before posting: yes, it does seem to simply
remove the useless declaration from the generated native code, because
this consumes the resulted computation and thus issues the error:
(let loop ((n 1000))
(if (zero? n) #f
(begin (display (/ 1 (- n 12)))
(loop (- n 1)))))
--
a game sig: http://tinyurl.com/d3rxz9
.
- References:
- Python and Scheme
- From: Grant Rettke
- Re: Python and Scheme
- From: Michele Simionato
- Re: Python and Scheme
- From: Sam TH
- Re: Python and Scheme
- From: Michele Simionato
- Re: Python and Scheme
- From: Sam TH
- Re: Python and Scheme
- From: Michele Simionato
- Re: Python and Scheme
- From: namekuseijin
- Re: Python and Scheme
- From: namekuseijin
- Python and Scheme
- Prev by Date: Re: Python and Scheme
- Next by Date: Re: Python and Scheme
- Previous by thread: Re: Python and Scheme
- Next by thread: Re: Python and Scheme
- Index(es):
Relevant Pages
|