unofficial mirror of bug-guile@gnu.org 
 help / color / mirror / Atom feed
From: Szavai Gyula <INVALID.NOREPLY@gnu.org>
To: "Ludovic Courtès" <ludo@gnu.org>,
	"Szavai Gyula" <szgyg@ludens.elte.hu>,
	bug-guile@gnu.org
Subject: [bug #30071] unfold isn't tail-recursive
Date: Thu, 10 Jun 2010 15:57:39 +0000	[thread overview]
Message-ID: <20100610-155738.sv74648.77461@savannah.gnu.org> (raw)
In-Reply-To: <20100608-214756.sv15145.12079@savannah.gnu.org>


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	other threads:[~2010-06-10 15:57 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
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 [this message]
2010-06-17 13:07     ` Ludovic Courtès
2010-10-08 14:28       ` Ludovic Courtès

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

  List information: https://www.gnu.org/software/guile/

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20100610-155738.sv74648.77461@savannah.gnu.org \
    --to=invalid.noreply@gnu.org \
    --cc=bug-guile@gnu.org \
    --cc=ludo@gnu.org \
    --cc=szgyg@ludens.elte.hu \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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).