unofficial mirror of bug-guile@gnu.org 
 help / color / mirror / Atom feed
* [bug #30071] unfold isn't tail-recursive
@ 2010-06-07 18:30 Szavai Gyula
  2010-06-08 21:47 ` Ludovic Courtès
  0 siblings, 1 reply; 5+ messages in thread
From: Szavai Gyula @ 2010-06-07 18:30 UTC (permalink / raw)
  To: Szavai Gyula, bug-guile


URL:
  <http://savannah.gnu.org/bugs/?30071>

                 Summary: unfold isn't tail-recursive
                 Project: Guile
            Submitted by: szgyg
            Submitted on: Mon 07 Jun 2010 06:30:34 PM GMT
                Category: None
                Severity: 3 - Normal
              Item Group: None
                  Status: None
                 Privacy: Public
             Assigned to: None
             Open/Closed: Open
         Discussion Lock: Any

    _______________________________________________________

Details:

(use-modules (srfi srfi-1))

(write
 (false-if-exception
  (let ((stack (* 0.05 (cadr (member 'stack (debug-options))))))
    (unfold (lambda (x) (> x stack)) identity 1+ 0)
    #t)))





    _______________________________________________________

Reply to this item at:

  <http://savannah.gnu.org/bugs/?30071>

_______________________________________________
  Message sent via/by Savannah
  http://savannah.gnu.org/




^ permalink raw reply	[flat|nested] 5+ messages in thread

* [bug #30071] unfold isn't tail-recursive
  2010-06-07 18:30 [bug #30071] unfold isn't tail-recursive Szavai Gyula
@ 2010-06-08 21:47 ` Ludovic Courtès
  2010-06-10 15:57   ` Szavai Gyula
  0 siblings, 1 reply; 5+ messages in thread
From: Ludovic Courtès @ 2010-06-08 21:47 UTC (permalink / raw)
  To: Ludovic Courtès, Szavai Gyula, bug-guile


Follow-up Comment #1, bug #30071 (project guile):

Hello,

Doesn't the TAIL-GEN argument prevent it from being implemented in a
tail-recursive fashion?

(When TAIL-GEN is omitted it can be tail-recursive.)

Thanks,
Ludo'.

    _______________________________________________________

Reply to this item at:

  <http://savannah.gnu.org/bugs/?30071>

_______________________________________________
  Message sent via/by Savannah
  http://savannah.gnu.org/




^ permalink raw reply	[flat|nested] 5+ messages in thread

* [bug #30071] unfold isn't tail-recursive
  2010-06-08 21:47 ` Ludovic Courtès
@ 2010-06-10 15:57   ` Szavai Gyula
  2010-06-17 13:07     ` Ludovic Courtès
  0 siblings, 1 reply; 5+ messages in thread
From: Szavai Gyula @ 2010-06-10 15:57 UTC (permalink / raw)
  To: Ludovic Courtès, Szavai Gyula, bug-guile


Follow-up Comment #2, bug #30071 (project guile):

; I mean the simple implementation

(define* (unfold p f g s #:optional (t (lambda (x) '())))
  (let loop ((s s) (a '()))
    (if (p s)
        (rev-append a (t s))
      (loop (g s) (cons (f s) a)))))

(define (rev-append xs ys)
  (if (null? xs)
      ys
    (rev-append (cdr xs) (cons (car xs) ys))))


    _______________________________________________________

Reply to this item at:

  <http://savannah.gnu.org/bugs/?30071>

_______________________________________________
  Message sent via/by Savannah
  http://savannah.gnu.org/




^ permalink raw reply	[flat|nested] 5+ messages in thread

* [bug #30071] unfold isn't tail-recursive
  2010-06-10 15:57   ` Szavai Gyula
@ 2010-06-17 13:07     ` Ludovic Courtès
  2010-10-08 14:28       ` Ludovic Courtès
  0 siblings, 1 reply; 5+ messages in thread
From: Ludovic Courtès @ 2010-06-17 13:07 UTC (permalink / raw)
  To: Ludovic Courtès, Szavai Gyula, bug-guile


Update of bug #30071 (project guile):

             Assigned to:                    None => civodul                


    _______________________________________________________

Reply to this item at:

  <http://savannah.gnu.org/bugs/?30071>

_______________________________________________
  Message sent via/by Savannah
  http://savannah.gnu.org/




^ permalink raw reply	[flat|nested] 5+ messages in thread

* [bug #30071] unfold isn't tail-recursive
  2010-06-17 13:07     ` Ludovic Courtès
@ 2010-10-08 14:28       ` Ludovic Courtès
  0 siblings, 0 replies; 5+ messages in thread
From: Ludovic Courtès @ 2010-10-08 14:28 UTC (permalink / raw)
  To: Ludovic Courtès, Szavai Gyula, bug-guile


Update of bug #30071 (project guile):

                  Status:                    None => Fixed                  
             Open/Closed:                    Open => Closed                 

    _______________________________________________________

Follow-up Comment #3:

Fixed along these lines:

 
http://git.savannah.gnu.org/cgit/guile.git/commit/?id=07076c1e61ab05b62979ee01a5220edb308b0750

Thanks!

Ludo'.

    _______________________________________________________

Reply to this item at:

  <http://savannah.gnu.org/bugs/?30071>

_______________________________________________
  Message sent via/by Savannah
  http://savannah.gnu.org/




^ permalink raw reply	[flat|nested] 5+ messages in thread

end of thread, other threads:[~2010-10-08 14:28 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2010-06-07 18:30 [bug #30071] unfold isn't tail-recursive Szavai Gyula
2010-06-08 21:47 ` Ludovic Courtès
2010-06-10 15:57   ` Szavai Gyula
2010-06-17 13:07     ` Ludovic Courtès
2010-10-08 14:28       ` Ludovic Courtès

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).