bug-guile
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

tail-call bug with map?


From: Keisuke Nishida
Subject: tail-call bug with map?
Date: 15 Oct 2000 23:13:46 -0400
User-agent: T-gnus/6.14.4 (based on Gnus v5.8.6) (revision 02) SEMI/1.13.7 (Awazu) Chao/1.14.0 (Momoyama) Emacs/20.7 (i686-pc-linux-gnu) MULE/4.1 (AOI)

Hello,

It seems the current Guile does not do properly tail-call
when a procedure is called through map.

  % guile -q
  guile> (define (foo x) x)
  guile> (define (bar x) (foo x))

Now `bar' should tail-call `foo`.

  guile> (trace foo bar)
  (foo bar)
  guile> (bar 1)
  [bar 1]
  [foo 1]
  1
  1

This is okay.  However,

  guile> (define (baz) (map bar '(1 2)))
  guile> (trace baz)
  (baz)
  guile> (baz)
  [baz]
  |  [bar 1]
  |  |  [foo 1]
  |  |  1
  |  1
  |  [bar 2]
  |  |  [foo 2]
  |  |  2
  |  2
  (1 2)
  (1 2)

This time `foo' is creating a new frame.  Is this correct?

Thanks,
Keisuke Nishida



reply via email to

[Prev in Thread] Current Thread [Next in Thread]