[Top][All Lists]

[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: 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)
    (rev-append (cdr xs) (cons (car xs) ys))))


Reply to this item at:


  Message sent via/by Savannah

reply via email to

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