bug-guile
[Top][All Lists]
Advanced

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

[bug #30071] unfold isn't tail-recursive


From: Szavai Gyula
Subject: [bug #30071] unfold isn't tail-recursive
Date: Thu, 10 Jun 2010 15:57:39 +0000
User-agent: Mozilla/5.0 (Windows; U; Windows NT 5.1; en-US; rv:1.9.1.8) Gecko/20100202 Firefox/3.5.8

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/




reply via email to

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