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