unofficial mirror of guile-devel@gnu.org 
 help / color / mirror / Atom feed
From: prj@po.cwru.edu (Paul Jarc)
Subject: Re: srfi-1 circular-list
Date: Fri, 19 Mar 2004 17:24:07 -0500	[thread overview]
Message-ID: <m3brms1nmq.fsf@multivac.cwru.edu> (raw)
In-Reply-To: <87fzc4h4hc.fsf@zip.com.au> (Kevin Ryde's message of "Sat, 20 Mar 2004 08:11:27 +1000")

Kevin Ryde <user42@zip.com.au> wrote:
> +(define (circular-list . lst)
> +  (if (not (null? lst))
> +      (set-cdr! (last-pair lst) lst))
> +  lst)

Or, if we want to preserve the error when no elements are given:
(define (circular-list elt1 . rest)
  (define lst (cons elt1 rest))
  (set-cdr! (last-pair lst) lst)
  lst)


paul


_______________________________________________
Guile-devel mailing list
Guile-devel@gnu.org
http://mail.gnu.org/mailman/listinfo/guile-devel


  reply	other threads:[~2004-03-19 22:24 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2004-03-19 22:11 srfi-1 circular-list Kevin Ryde
2004-03-19 22:24 ` Paul Jarc [this message]
2004-03-19 22:32   ` Kevin Ryde

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=m3brms1nmq.fsf@multivac.cwru.edu \
    --to=prj@po.cwru.edu \
    /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).